I’m developing an app that using timer function. An important function in the timer is to check whether the user uses another app. If the user use another app, the timer should stop working. and if the user just screen off without exiting from my app, the timer should keep running.
So, I need to distinguish these background status(just screen off in my app or use another app)
I’ve tried utilizing ‘background/foreground status of my app’ + ‘Screen on/off’ status, because I think ‘screen on + background’ means that the user exits from my app and ‘screen off’ means that the user does not use another app. So I implements it in Android with ‘WidgetsBindingObserver’ that provides the app’s lifecycle status, ‘BroadcastReceiver’ in android native function that provides status of screen. However in IOS, I noticed that there was no way to detect screen on/off. (Although private API seems to meet my need, but I heard that this is not allowed in AppStore).
Is there a way for this feature in flutter?
lsheeeo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.