internet_connection_checker_plus icon indicating copy to clipboard operation
internet_connection_checker_plus copied to clipboard

[Feature Request] Stop listenning for internet status when app goes to background

Open orkun1675 opened this issue 1 year ago • 3 comments

Apps are more likely to be killed by the OS if they keep using the network when they are in the background.

Using AppLifecycleListener can we stop the Timer that checks the network status when app is not in the foreground?

My app has no use for information about internet status when its not being actively used. I actually turn off all network services, such as Firebase document listeners, when app goes out of focus.

Thank you!

orkun1675 avatar Feb 07 '24 03:02 orkun1675

Hi @orkun1675, this looks like a feature request as not many people are concerned with their app working in background.

I'm currently busy in some other work but if you can implement it, feel free to do it. PRs are always welcomed.

OutdatedGuy avatar Feb 08 '24 00:02 OutdatedGuy

@OutdatedGuy I believe this is actually a valid feature request. I will try creating a PR when I find the time. I did not have the time to check the new AppLifecycleListener but I think it should be doable.

I've had issues with users leaving the app open for ages that ran into the new connection dialog being shown even though they were connected with the internet.

peer-f avatar Mar 25 '24 13:03 peer-f

@peer-f are you still working on this??

Djsmk123 avatar Apr 05 '24 08:04 Djsmk123

Hi, I looked into the AppLifecycleListener as mentioned in the original post and it seems like using that should be implemented into a StatefulWidget. The InternetConnection is just a normal class so it does not have any initState and dispose methods to start listening to App Lifecycle changes and dispose it.

So instead I'll add documentation into README for anyone willing add it into there widgets.

OutdatedGuy avatar Sep 16 '24 10:09 OutdatedGuy