从浏览器唤起app

我在androidManifest中添加唤起的代码

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:scheme="tlqipai"
                android:host="xlkj"/>
        </intent-filter>
    </activity>

但发现在启动的时候在cocos2dxActivity.java中的onCreate有这么一段
if (!isTaskRoot()) {
// Android launched another instance of the root activity into an existing task
// so just quietly finish and go away, dropping the user back into the activity
// at the top of the stack (ie: the last state of this task)
finish();
Log.w(TAG, “[Workaround] Ignore the activity started from icon!”);
return;
}

直接就return了导致没有唤起应用。这个需要怎么配置才能不被return?

同问置顶

你好,我最近也写了这个东西,我写的没有问题,这里应该是只允许启动一个实例,所以给return了。
另外我发现你的配置跟我的不一样,
android:launchMode=“singleTop” 这个建议改成 android:launchMode=“singleTask”
这样改应该就没有问题了

2赞