- Home /
Home button on Android is causing my game to exit but I never did that before.
The home button on Androids is closing my game instead of just pausing it and minimizing. It never used to exit, though. Before, the home button would always call OnApplicationPause(true) and I would have the menu pop up and Time.timescale set to 0. Now, the game just exits.
Any help?
Do you have "Don't keep activities" turned on in the device's Developer Options?
Have you checked the logs? I mean, do you know for sure that the game is "just exiting" or could it be that it is crashing?
Answer by purnjay · Oct 27, 2015 at 11:56 AM
home button is used for quiting a application so if you will use it to make your game pause sometime it will quit the gam so make your own pause button
The home button does not quit an app by default, it pushes it into the background.
Answer by Bill-Ape · Nov 22, 2016 at 11:24 AM
I just had this! The answer for me was to remove all the deprecated old sections from the AndroidManifest.xml, then the Home button worked fine and restoring the app from the recent list.
Before:
<activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>
After:
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>