如果从超链接打开,应用程序将启动两次

use*_*020 5 android android-manifest

我正在开发一个应用程序,可以从多个位置启动,例如日历中的超链接。我在以下场景中遇到问题:如果应用程序已启动并在后台运行,并且用户单击本机日历中的事件/超链接来启动应用程序。我的应用程序作为新实例启动两次。在正在运行的应用程序列表中,我可以看到应用程序的两个实例。我已经为我的主要活动尝试了 android:launchMode="singleInstance" 和 "singleInstance" 属性,但仍然不起作用。有人可以建议我解决方案吗?

我的清单如下所示:

<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name="com.org.ManishApp" 
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" 
android:launchMode="singleInstance">
<intent-filter>`enter code here`
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)

Nit*_*sra 0

您是否在清单中添加了此意图过滤器

<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="http" />
                <data
                    android:host="yify-torrents.com"
                    android:pathPrefix="/" />
            </intent-filter>
Run Code Online (Sandbox Code Playgroud)

pathprefix 是域“example.com”之后的子目录