Android Freeze Game in Background

If you start the game and lock the phone on android (go into sleep mode) and go back to the game, the application and the phone tightly freeze.

Device: Samsung Galaxy Note 4 (SM-N910A);

Android Persmissions: All;

Android version: 4.4 (official/no root);

Unreal Engine 4.7 - 4.7.1

forum: link

Howdy Prynec,

Thank you for reporting this issue. I have attempted to reproduce this issue internally and have been unsuccessful so far. Would you be using a source version of UE4 or a Binary version? What method would you be using to deploy the project onto your device?

I was using a nexus 6 (closest specifications to a Note 4) to test this issue on Engine version 4.7.2.

Any additional information would be greatly appreciated.

Thanks and have a great day!

Used different modes of build, as debug and shiping;
The problem remains the same and the Samsung Galaxy Note 4 (SM-n910c).
The project uses google services. (without the use of services project is not checked)

link text

Would you be able to test this issue on a different device, or if you have, is it only occurring on this device?

Would you be able to provide the logcat file as well? You can use this route to find the Android Device Monitor: C:\NVPACK\android-sdk-windows\tools\monitor.bat

Once that is up and running, you will need to create this folder under the Saved Filters tab:

20962-logcat.jpg

Once created, be sure that the device does not have any instance of the UE4 game running in the background. Then, on the right middle side of the Android Device monitor, you will see a red x over a document. Press this to clear the log and then press the app on your device.

Under the tab that you have created, you should see logs being created. when the log slow down to a halt, select all of the logs and, next to that red x, hit the save option. this will create a file that you should be able to share here.

Thanks!

Howdy prynec,

Just wanted to check in and see if this issue is still occurring for you. If so, Would you be able to provide the information asked for in the comment above?

Thanks and have a great day!

Hi prynec,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

Hi ,

the issue still persists in UE4.7.3. I am running my game on an HTC One with Android 4.4. When locking the screen while the game is open and then trying to unlock it, the phone crashes.

Here is the logcat

Hey trutty,

Thank you for reporting this issue. I am going to need a bit more information from you before I begin investigating. Would you be using a binary or source build of UE4? Would the project that you are seeing the freeze on be a blueprint project or a C++ project?

Are you able to recreate this issue with a blank template project? If so, would you be able to provide steps on how i may be able to replicate this issue internally?

Any additional information would be greatly appreciated.

Thanks and have a great day!

Howdy trutty.

Juts wanted to check in with you and see if you were still experiencing this issue. If so, would you be able to provide the additional information asked for in the comment above?

Thanks!

Hi ,
I am experiencing the same problem:

Device: Samsung Galaxy Note 3 (SM-N900A);

Android Persmissions: All;

Android version: 5.0 (official/no root);

Unreal Engine 4.8.2

I attached the monitor log for running the app (holo3d) until the screen goes to sleep and then nothing else is recorded under UE4|Debug

Looking at the raw logcat after I managed to get back to the homepage, I saw that:

I/Timeline( 1461): Timeline: Activity_launch_request id:com.holo3d.holo3d time:26235570
E/PersonaManagerService( 800): inState(): stateMachine is null !!
I/PersonaManagerService( 800): PersonaId don’t exist
I/ActivityManager( 800): do not start freezing screen for locked container getKeyguardshowstate = false
D/ResourcesManager( 800): creating new AssetManager and set to /data/app/com.holo3d.holo3d-1/base.apk

and then later:

W/WindowManager( 800): Force clearing orientation change: Window{e38d9af u0 com.holo3d.holo3d/com.epicgames.ue4.GameActivity}
…
I/WindowManager( 800): Screen frozen for +2s13ms due to Window{e38d9af u0 com.holo3d.holo3d/com.epicgames.ue4.GameActivity}

and then later:

W/ActivityManager( 800): Activity stop timeout for ActivityRecord{7da7151 u0 com.holo3d.holo3d/com.epicgames.ue4.GameActivity t1937}
I/ActivityManager( 800): Activity reported stop, but no longer stopping: ActivityRecord{7da7151 u0 com.holo3d.holo3d/com.epicgames.ue4.GameActivity t1937}

This is an extremely annoying problem because it difficult to restart the app once it goes into sleep mode. I found that by killing the app in monitor allowed me to successfully restart the app without having to reload it from adb.

The app is a blueprint project and we are using the binary build of UE4.
The problem does not seem to affect TappyChicken or the 3rd person example demo.

Cheers

Adding a “Control Screen Saver” node seems to fix the problem.

Cheers

Hi,
I started to have this problem today, my phone (S4 mini) got completely frizzed after entering Standby mode with my UE4 [4.8.3] game running.

I have noticed that the only important change I did was to change the API level from 10 to 14. Going back to Api Level 10 and the issue has gone!

Hi.

I came across this problem and it is partly an Android issue… In design…

Anyway, the problem is that when the Android detect a configuration changes, like changing orientation or showing keyboard it will reset the app by default. This will cause onDestroy and onCreate launch and Unreal Engine has serious problems with handling this kind of event.

But fear not! According to this entry Android activity onDestroy() called on screen lock - Stack Overflow You simply need to add a “screenSize” option to the android:configChanges= in the activity definition in the Manifest.xml. Putting phone to sleep is the part of changing screenSize and with this option the application won’t reset itself.

It helped me! Hope it will help You!


By the way, in LaunchAndroid.cpp in the OnAppCommandCB function there is this part:

case APP_CMD_DESTROY:
		/**
		* Command from main thread: the app's activity is being destroyed,
		* and waiting for the app thread to clean up and exit before proceeding.
		*/
		UE_LOG(LogAndroid, Log, TEXT("Case APP_CMD_DESTROY"));
		FAppEventManager::GetInstance()->EnqueueAppEvent(APP_EVENT_STATE_ON_PAUSE);
		break;

Shouldn’t it pass the APP_EVENT_STATE_ON_DESTROY instead of the APP_EVENT_STATE_ON_PAUSE?

1 Like