【问题标题】:Intent-filter - Open NEW application, not embedded one意图过滤器 - 打开新的应用程序,而不是嵌入的
【发布时间】:2015-05-15 08:16:40
【问题描述】:

我不知道这是否真的可以理解。

当我单击邮件中的链接时,我可以使用我的应用程序打开此链接,这正是我想要的。

<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>

但是

当我像这样打开我的应用程序并检查打开的应用程序时,我看到我的应用程序是“内部”Gmail 任务,就像那样

但是,例如,当我用 Chrome 打开链接时,Chrome 会在他自己的任务中打开,就像那样

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

【问题讨论】:

    标签: android android-intent task intentfilter


    【解决方案1】:

    你必须为你的活动设置一个特定的andorid:launchMode

    android:launchMode="singleTask"
    

    android:launchMode="singleInstance"
    

    将你的activity声明放在AndroidManifest.xml中就可以了。

    还可以查看 this 解释 android 如何处理任务和活动的文章

    【讨论】:

    • 哦,对了,我刚刚看到我还没有添加任何启动模式。我正在尝试并在感谢后重新评论
    猜你喜欢
    • 1970-01-01
    • 2013-11-20
    • 2013-10-03
    • 2012-01-07
    • 2012-10-28
    • 1970-01-01
    • 2021-07-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多