Java 应用程序链接助手Android Studio在第一个应用程序活动中打开
我使用Android Studio中的“应用链接助手”来配置将通过我的应用打开的链接 一切正常 但我的问题是,当我通过应用程序打开链接时,它会打开在我单击链接的前一个应用程序中定义的活动 例如: 如果我点击WhatsApp中的链接,我会看到如下内容: 当我使用该应用程序打开时,该应用程序将在WhatsApp中打开,如下图所示: 那么,我如何仅在我的应用程序中打开应用程序,而不在WhatsApp或其他应用程序中打开应用程序 下面是此活动的my AndroidManifest.xml代码:Java 应用程序链接助手Android Studio在第一个应用程序活动中打开,java,android,android-manifest,android-app-links,Java,Android,Android Manifest,Android App Links,我使用Android Studio中的“应用链接助手”来配置将通过我的应用打开的链接 一切正常 但我的问题是,当我通过应用程序打开链接时,它会打开在我单击链接的前一个应用程序中定义的活动 例如: 如果我点击WhatsApp中的链接,我会看到如下内容: 当我使用该应用程序打开时,该应用程序将在WhatsApp中打开,如下图所示: 那么,我如何仅在我的应用程序中打开应用程序,而不在WhatsApp或其他应用程序中打开应用程序 下面是此活动的my AndroidManifest.xml代码: &
<activity android:name=".extraLinks"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
>
<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"
android:host="www.jtube.live" />
</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="https"
android:host="www.jtube.live" />
</intent-filter>
</activity>
更新:我检查了我的Gmail和Chrome应用程序,如果我从这些应用程序打开,其工作正常,因此我的Whatsapp应用程序问题仅限于…尝试以下操作:
<intent-filter android:label="app_label">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="www.jtube.live" />
</intent-filter>
当活动A启动活动B时,默认行为是: 在当前任务中创建活动B的新实例,并将其推送到后堆栈 要自定义此类行为,有一些选项:
- 向启动特定活动的意图添加标志李>
- 为正在启动的活动设置
属性李>launchMode
launchMode
属性。有两个可能的值适用于您的案例:singleTask
或singleInstance
查看以下链接以了解其工作原理:
- )李>
- )李>