Game doesn't suspend when screen off
Monkey Targets Forums/Android/Game doesn't suspend when screen off
| ||
When the phone lock screen setting is set to "none", the app continues to run on the background when the screen is off (OnSuspend isn't called). Tested with Android versions 4.4.2 and 6.0.1 on Samsung devices. Seems to be problem with other people's published Monkey games too, but doesn't happen with other games I tried. Help? |
| ||
Fixed by adding few lines to androidgame.java. Don't know yet if the changes cause any new problems..@Override public void onResume(){ super.onResume(); for( ActivityDelegate delegate : _game._activityDelegates ){ delegate.onResume(); } >>> _view.onResume(); >>> _game.ResumeGame(); } @Override public void onPause(){ super.onPause(); for( ActivityDelegate delegate : _game._activityDelegates ){ delegate.onPause(); } >>> _game.SuspendGame(); >>> _view.onPause(); } |
| ||
Thanks Rieha, I think Mark should add that as well! |