How to set Android launchMode from Unity

I am trying to change the launchMode of Unity’s activity from “singleTask” to “standard”. However, if I just change it in the AndroidManifest file in Plugins/Android, it gets reverted to “singleTask” when building (seen in the output project in tmp). If I export it to Eclipse and change the manifest there, it all compiles and runs fine.

In essence, I am looking for a way to change UnityPlayerActivity’s launch mode from “singleTask” to “standard” without exporting to an eclipse project.

Any ideas? Thanks in advance.

Try comment this meta-data In AndroidManifest:

<meta-data android:name="unityplayer.UnityActivity" android:value="true"/>

You need to provide your own custom AndroidManifest.xml and place it under Plugins/Android (or a subfolder under it).

I just tried doing that and it works fine.

Unity (according to the documentation) will pick up all AndroidManifests and merge them together with the main manifest as mentioned in this link: Unity - Manual: Create and use plug-ins in Android

You can drop pre-compiled Android
library projects into the
Assets->Plugins->Android folder.
Pre-compiled means all .java files
must have been compiled into jar files
located in either the bin/ or the
libs/ folder of the project.
AndroidManifest.xml from these folders
will get automatically merged with the
main manifest file when the project is
built.

Here is the manifest i used (put under Plugins/Android, make sure to change the package name to whatever you configured in your project!!) :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company.product">
  <application android:icon="@drawable/app_icon" android:label="@string/app_name">
    <activity android:name=".UnityPlayerActivity"
             android:label="@string/app_name"
             android:launchMode="standard"
             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>
  </application>
</manifest>