java - 在接收器之外的 App Link 中打开应用程序
问题描述
使用 App Links 时,接收者应用程序(EX. Whatsapp)会暂停,并且您的应用程序的活动会在接收者应用程序之上打开。
例如,如果您从 WhatsApp 的聊天页面打开链接,则不会从您的应用程序中打开新活动(最近应用程序中的 WhatsApp 任务包括您的应用程序),而您的应用程序不在最近任务中。
但是如果我想在一个新任务中打开我的应用程序怎么办?与接收方应用程序分开?
这是我从应用链接打开的活动的清单文件:
<activity
android:name=".Activitys.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter
android:autoVerify="true"
android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="eventtk.uae-dc.com"
android:pathPrefix="/product/"
android:scheme="https" />
</intent-filter>
</activity>
有什么我应该添加到 IntentFilter 的吗?
解决方案
不确定我是否正确理解您想要实现的目标,但您可以尝试添加
android:launchMode="singleTask"
到您的活动定义。
更多信息在这里: https ://inthecheesefactory.com/blog/understand-android-activity-launchmode/en
推荐阅读
- php - 如何从 Codeigniter 中的返回结果运行多个查询
- scala - 如果我修改指向缓存 rdd 的变量会发生什么?
- laravel - Laravel 项目在共享主机上使用 bitbucket 管道
- docker - 在 Kubernetes pod 中使用 docker socket
- python - 错误:“make: * [Makefile:163: all] 错误 2”和“make: * [Makefile:163: all] 中断”
- snowflake-cloud-data-platform - 单一模式上的雪花授予选择
- javascript - Angular JS将多个数组传递给scope.list
- javascript - 如何从普通的 Javascript 函数中调用 ReactJS 类组件和功能组件?
- php - 这是否可以在单列中使用两个 id 以在 laravel 中建立模型关系
- javascript - 使用循环将给定数组转换为对象数组