在该线程之后,
Re-launch of Activity on Home button, but...only the first time
当我从文件浏览器启动应用程序时,我可以在其应用程序上启动多个版本,但正常的图标启动不会发生这种情况。我已经设置了onCreate来做到这一点。
@override
protected void onCreate (final Bundle savedInstanceState)
{
if (!isTaskRoot())
{
finish ();
return;
}
super.onCreate (savedInstanceState);
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxx.xxx.xxx"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto">
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:glEsVersion="0x00020000" />
<application
tools:replace="android:allowBackup"
android:label="@string/app_name"
android:allowBackup="false"
android:icon="@mipmap/icon">
<!-- Tell Cocos2dxActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="MyGame" />
<activity
android:name="org.cocos2dx.cpp.AppActivity"
android:clearTaskOnLaunch= "true"
android:screenOrientation ="sensorLandscape"
android:configChanges ="orientation|keyboardHidden|screenSize"
android:label ="@string/app_name"
android:theme ="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode ="singleInstance"
android:taskAffinity ="" >
<intent-filter>
<action android:name ="android.intent.action.MAIN" />
<category android:name ="android.intent.category.LAUNCHER" />
<category android:name ="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name ="io.fabric.ApiKey"
android:value ="XXXXXXX"
/>
</application>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>