Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / Problems with screen sleeping

Author
Message
Naphier
8
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 1st Apr 2013 23:16
My game is in beta and users have noticed that the app prevents the device from sleeping. Ancient Lady suggested removing WAKE_LOCK from the AndroidManifest.xml, but unfortunately this hasn't changed anything. I also checked with Dodge Those Balls and it appears to prevent the device from sleeping.
Has anyone had luck with the app actually allowing the device to sleep?

One of my testers has a Galaxy S3 and the game actually freezes when the device tries to sleep.

Naphier
8
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 6th Apr 2013 00:40
If you edit jni/main.h
and remove or comment out the following line:
ANativeActivity_setWindowFlags( state->activity, AWINDOW_FLAG_KEEP_SCREEN_ON, 0 );

The device will be able to enter sleep mode

You can then also remove WAKE_LOCK permission from the AndroidManifest.xml file
I don't think removing the permission is necessary, but there's no need to have it if your app isn't preventing sleep.

I'm still running into a minor issue in Android 4.2.x where if you don't have a screen lock (swipe to unlock/pin/password/etc) and you press the screen off/sleep button, then the app keeps running.
Not sure if this is an AppGameKit issue, or an Android issue though. I've tried it out with a number of non-AGK apps and some stay running, some crash, some pause, some suspend. So I think that it is something Android should address. If not, at least it is common for this to be buggy with other games!

Login to post a reply

Server time is: 2019-08-23 23:02:17
Your offset time is: 2019-08-23 23:02:17