How To Detect When The Screen Will Turn Off?
Is it possible to detect when screen will turn off and catch it? I want to set timer for 15 seconds in global settings of Android. I am trying to find some information how to catch
Solution 1:
Just register your app for the actions Intent.ACTION_SCREEN_OFF
and Intent.ACTION_SCREEN_ON
and do what you want when these events are broadcasted.
Create a dedicated BroadcastReceiver
class (and add it to the manifest) or register a BroadcastReceiver
at runtime.
Post a Comment for "How To Detect When The Screen Will Turn Off?"