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.
Anyway, I can force a logon for the onCreate 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 onResume handler get called for all kinds of things, like just returning from another Activity in the same app, so that's too generic.
How can I detect when my app wakes up from a display time out?
N.B. - I don't care if I detect a display turn-on per se There are several discussions on Stack Overflow about detecting screen turn on ( Android - how to receive broadcast intents ACTION_SCREEN_ON/OFF?) where the consensus seemed to be that this hard and maybe even deliberately discouraged. I just want to know when my own app "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?
Thanks in advance.