App hangs when waking up from suspend mode on Android

Hello,

I have this problem, after I launched app on Android device, I pressed power button to enter suspend mode, and after 5 to 10 seconds pressed power button again, then I will see a totally black screen, and the buttons on the navigation bar are not responding, in this case I will need to force reboot my device.

Any ideas?

Hi ZenTechEntertaiment,

On what device are you testing, and what is its OS? Are you able to get logcat from the time of the hang?

Thank you wittlief,

So far I’ve tested (5.1.1), Sony Z3(5.0.2), Samsung Note 4(5.0.1), and all of them will hang.
Here’s the logcat log from and Note 4.[link text][1]

[link text][2]

48438-log.txt (59 KB)
[2]: 48439-log+note4.txt (373 KB)

Hi ZenTechEntertaiment,

On conferring with the Android dev, here is what he’s seeing in your :

There’s an APP_CMD_DESTROY so it actually killed the game. Normally if you just turned off the screen you’d see APP_CMD_SAVE_STATE / APP_CMD_PAUSE / APP_CMD_LOST_FOCUS. On waking up, you’d see APP_CMD_RESUME / APP_CMD_TERM_WINDOW / APP_CMD_INIT_WINDOW / APP_CMD_GAINED_FOCUS.

Hope that helps!

OK, I think I figured it out.

Thanks for wittlief’s answer pointed out the problem was onDestroy being called, I then did some research on it:

I realized I have to add

android:configChanges="orientation|keyboardHidden|screenSize"

in AndroidManifest.xml if Android API Level is greater than 13, but you can’t just modify the xml directly, you have to modify UEDeployAndroid.cs, and it already had set orientation|keyboardHidden, I added screenSize right after it.

Now my app no longer reveiced onDestroy when turning off the screen, it looks like the issue has been resolved.

I can confirm this, had the same issue. Still using 4.7, but are there any changes in place/mind to make this more available to fix? I do not think I am able to modify UEDeployAndroid.cs without the source code, and this issue is definitely happening on multiple devices on multiple versions if the android api level is 13 or greater. I do not think that even in 4.8 we can append to the configChanges without tampering with the source code. I haven’t been following the changes and updates to the engine as much as I should but this should get fixed if it hasn’t been already.

Hey,

I wanted to let you know that screenSize was added to android:configChanges in AndroidManifest.xml to prevent onDestroy issues on suspend. This should be implemented in 4.9, after speaking with our Android Developer. I made sure to request that this was placed in the release notes as well.

Thanks!