Intent-filter - 打开新应用程序,而不是嵌入式应用程序

Intent-filter - Open NEW application, not embedded one

不知道是不是真的可以理解

当我点击邮件中的 llink 时,我可以用我的应用程序打开这个 link,这正是我想要的。

<intent-filter>
    <data android:scheme="https" android:host="xxx.xxx.com"/>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

但是

当我打开我的应用程序时,我检查了打开的应用程序,我看到我的应用程序是 "inside" Gmail 任务,就像那样

但是,当我用 Chrome 打开 link 时,Chrome 正在打开他自己的任务,就像那样

我的应用程序如何在她自己的任务中打开,而 NOT 在 Gmail 的任务中打开?

您必须为您的 activity 设置特定的 andorid:launchMode:

android:launchMode="singleTask"

android:launchMode="singleInstance"

将你的activity声明放在AndroidManifest.xml中即可。

另请参阅 this 解释 android 如何处理任务和活动的文章