I have an Android app that handles activate and deactivate events by saving state and pausing all the amimation and sound on the deactivate event and resuming on the activate event. This works fine, except that if the device has a lock screen enabled, what happens is this:
Game is running
Device goes to sleep
- game pauses, saves state and shuts up
User wakes device
- lock screen displays
- while lock screen is up, app starts up again - playing sound and such BEHIND the lock screen
- user unlocks the screen - adnd we are good.
Is there a way to tell when the app does not have focus - as in the lock screen is frontmost? I know you can in pure Android development. I believe it invoves knowing the current "active window".