Unity Android game crashes when reopened from the home screen.

Hello,

Our game is ready or not really ready for Android.

When I play the game and I hit the home button, I get to
the android main screen and the app is minimized. If I go
to all running apps (holding home button) I can return to my
game and continue playing without any trouble. The problem is
if I leave the app with home button and then i want to return to
my app by clicking my game icon in android menu or “desktop”.

Then the app crashes. The same things happen to big titles like
Subway Surfers or Bad Piggies.

What is the problem here?

Thank you!

Peter

Maybe it is your device? I have ported to Android and I do NOT have this issue. Once I click the home button I can access my app by clicking the app icon or by clicking the little thumbnail preview when holding down the home button (in the “recent apps” view).

I ran a few tests, I can click the home button, open a new app, close that app, open yet another app, close that one, turn the screen off on my phone, wait 3 minutes, turn my screen on, then resume my app by clicking it’s icon.

To be more specific:
-My app was opened, started a new game and played for about 2 minutes [Hit the home button]
-The first app I opened was open for about 5 minutes, and I closed out of it by hitting the back button till it closed.
-The second app was open for about 1 minute and I clicked the home button instead of closing out.
-Turned off screen for about 3 minutes
-Turned screen on, waiting about 30 seconds
-Clicked my app icon on my home screen
-App was 100% where I left off. No crash, no reloading, just resumed.

My android device I tested this on was the Samsung Galaxy S3. I built my apk as a developer build and turned on script debugging.

My app uses ~140mb of RAM in this specific example.

@Madarina did you find a solution to the problem?

In my case the app always crashes when running in background and opened through app icon. However, works fine when accessed through recent apps screen.

Here is my log, unfortunately doesn’t tell much.

05-17 12:44:17.824   780  1391 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.google.android.googlequicksearchbox/com.google.android.launcher.GEL} from uid 10019 on display 0
05-17 12:44:24.988   780   791 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=pk.codistan.madhunt/com.google.firebase.MessagingUnityPlayerActivity (has extras)} from uid 10021 on display 0
05-17 12:44:25.058   780  1476 W ActivityManager:   Force finishing activity pk.codistan.madhunt/com.google.firebase.MessagingUnityPlayerActivity
05-17 12:44:25.569   780   793 W ActivityManager: Activity pause timeout for ActivityRecord{45b3d9f u0 pk.codistan.madhunt/com.google.firebase.MessagingUnityPlayerActivity t2165 f}
05-17 12:44:28.364   780  1476 I ActivityManager: Process pk.codistan.madhunt (pid 29359) has died
05-17 12:44:28.364   780  1476 D ActivityManager: cleanUpApplicationRecord -- 29359
05-17 12:44:28.364   780  1476 W ActivityManager: Scheduling restart of crashed service pk.codistan.madhunt/com.onesignal.SyncService in 1000ms
05-17 12:44:29.383   780   793 I ActivityManager: Start proc 30817:pk.codistan.madhunt/u0a225 for service pk.codistan.madhunt/com.onesignal.SyncService

if it is developer build then you can launch it once, second time it will not launch from icon again.