my app does something when the screen goes black, but I want it to only carry out that task if the screen was turned off “by itself”, through a screen timeout – NOT when the user presses the power-button. Is there any way to distinguish between these two events?
ACTION_SCREEN_OFF obviously fires in both cases, and I haven’t found any other intents that might match what I’m looking for.
At the lower level there’s an event happening when the screen times out, take a look with “adb logcat” and you’ll see it, dig from there.