From an Android service (for example at onCreate time) how can I determine whether screen was on or off before receiving the first broadcast screen intent (that may never be triggered if screen was already off and user does not use its phone) ?
If you want to test if the screen is on, you can use http://developer.android.com/reference/android/os/PowerManager.html#isScreenOn() .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With