Distinguish between screen timeout and power-button-press?

Posted by Nick on Stack Overflow See other posts from Stack Overflow or by Nick
Published on 2010-05-04T19:14:58Z Indexed on 2010/05/04 19:18 UTC
Read the original article Hit count: 187

Filed under:

Hi,

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 those 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.

Thanks for your help, Nick

© Stack Overflow or respective owner

Related posts about android