Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distinguish between screen timeout and power-button-press?

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.

like image 381
Nick Avatar asked May 04 '10 19:05

Nick


People also ask

What does screen timeout mean?

Screen Timeout is an option on Samsung devices that will turn the screen off to save battery life. Out of the box the default is 30 seconds.

How do I change my screen timeout?

To get started, open the Settings app. From there, scroll down to Display. In the Display settings menu, look for the Screen Timeout option.


1 Answers

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.

like image 126
berkus Avatar answered Sep 30 '22 11:09

berkus