So I have my onResume
command restarting a stopped thread which runs my game loop.
This works perfectly for resuming the app when closed by home button or by focusing on another app.
However, when you turn the screen off then on again, the activities onResume
command fires right away before screen is unlocked. I need my activity to know when the screen is unlocked so it can restart the thread at the appropriate time.
Has anyone had this happen before?
for detect screen on and screen off register a broadcast reciver like:
AndroidManifest.xml:
In Activity or Service:
receiver code where System inform you if Screen on/off happen: