Android Question KeepAlive with multiple Modules

cyiwin

Active Member
Licensed User
Longtime User
I saw a post similar to this but it didn't solve my problem. I have a strategy game that goes back and forth between 2 activity modules. I use KeepAlive to keep the phone from sleeping while the game is being played.

If I put KeepAlive in both Activity_Resumes and ReleaseKeepAlive in both Activity_Pauses then the phone will try to go to sleep between modules and causes issues.

If I put KeepAlive once at the start of the game and ReleaseKeepAlive on any possible exits, what if the user pushes the Home button? I don't want their phone to stay awake while my game isn't on the screen either.

Any other options?
 
Top