title: How to detect when app "wakes up" from a display timeout?
body: <p>For an industrial app the customer has requested that the user be required to logon when the app is first stated, and again if the device "goes to sleep" meaning if he puts the device down and the screen goes off.    This is so if the user has put the device down and walks away and someone else on the factory floor finds it later that person has to log-into the app under his own ID.</p>
  
  <p>Anyway, I can force a logon for the <em>onCreate</em> event of the main screen Activity when the app first starts up but there doesn't seem to be an Activity life-cycle event for "waking up" after a display timeout.  The <em>onResume</em> handler get called for all kinds of things, like just returning from another Activity in the same app, so that's too generic.    </p>
  
  <p>How can I detect when my app wakes up from a display time out?</p>
  
  <p><strong>N.B.</strong>  - I don't care if I detect a display turn-on <strong>per se</strong>   There are several discussions on Stack Overflow about detecting screen turn on ( <a href="https://stackoverflow.com/questions/1588061/android-how-to-receive-broadcast-intents-action-screen-on-off">Android - how to receive broadcast intents ACTION_SCREEN_ON/OFF?</a>) where the consensus seemed to be that this hard and maybe even deliberately discouraged.   I just want to know when <strong>my own app</strong> "wakes up".     If detecting screen turn on is the only, or best, way to do this could someone please point me to some sample code?  </p>
  
  <p>Thanks in advance.</p>