Android Unity Activity Launch Mode

Skillz has a customized way that we manage your game's Activity, as well as the Activities that Skillz itself uses. This customized style requires your app use a specific `launchMode` flag in order to make sure that background/foregrounding, as well as transitioning between your game and Skillz works smoothly.

In your typical AndroidManifest.xml file, the default supplied by Unity, specifies UnityPlayerActivity as the main Activity for the application, and has a flag for the launchMode to be "singleTask", and probably looks very similar to this: 

<activity android:label="@string/home_name" 
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:clearTaskOnLaunch="false"
android:alwaysRetainTaskState="true"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale"
android:name="com.skillzgames.caverun.UnityPlayerActivity">

You'll notice this is set to "singleTask". Due to Android's activity management, this can lead to your app being loaded back up as a black screen when brought to the foreground from the background when using the App Icon to reopen the app.

 

To fix this issue, you simply need to specify your launchMode as "singleTop", like so:

<activity android:label="@string/home_name" 
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:clearTaskOnLaunch="false"
android:alwaysRetainTaskState="true"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale"
android:name="com.skillzgames.caverun.UnityPlayerActivity">