对于一个项目,我遇到了一个非常奇怪的问题:
Deeplinks在过去的一年里一直工作得很好,但最近(从2019年1月初开始),我们收到了用户的抱怨,说deeplinks停止工作了(有人说10次中有9次)。
我们没有更改任何代码,并且很难重现此问题。
更奇怪的是,在我们自己遇到这个问题的少数时候,android操作系统甚至不会通过“打开方式”对话框将我们的应用程序显示为一个选项。这向我们表明,操作系统有时会忘记应用程序在其清单中注册了意图过滤器。
重启应用程序似乎可以修复这个问题,deeplinks又开始工作了。这个应用程序似乎也在我们每次从Android Studio进行新的构建时都能工作,这使得它很难重现。
我们的清单有一个处理deeplinks的特定活动:
<activity
android:name="com.company.DeepLinkActivity"
android:noHistory="true"
android:launchMode="singleTask">
<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:host="ideal-payment"
android:scheme="com.company.ideal" />
<data
android:host="ideal-payment"
android:scheme="com-company-ideal" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="${appLinkIdealHost}"
android:pathPrefix="/ideal-betaling/landingpage"
android:scheme="https" />
</intent-filter>
<intent-filter android:autoVerify="true">
...
</intent-filter>
<intent-filter android:autoVerify="true">
...
</intent-filter>
</activity>
我们认为这可能与autoVerify不可访问有关,但是操作系统应该显示“打开方式”对话框,当问题浮出水面时,这不会发生。
有没有人遇到过类似的问题?如有任何帮助或建议,将不胜感激。
发布于 2019-03-18 03:11:21
例如,当应用程序因异常而停止时,或者当用户从某些设备的设置或中强制停止应用程序时,当用户从历史记录(或任务)中删除应用程序时,应用程序将自动强制停止(对于制造商来说,这不是一个好的选择)当应用程序处于已停止状态时,其清单intentFilter
将不会被使用(当应用程序首次安装且从未打开时,它也处于此阶段)
处于已停止状态时,应用程序将不会因为任何原因而运行,除非手动启动活动,或明确意图处理活动、服务或广播。
https://riptutorial.com/android/example/30592/android-stopped-state
你提到的大多数Android版本是8或更高,因此下面的报价也可能有用,但这是针对服务和广播接收器的。
每当应用程序在后台运行时,它都会消耗设备的一些有限资源,比如内存。这可能会影响用户体验,特别是当用户使用资源密集型应用程序时,例如玩游戏或观看视频。为了改善用户体验,Android8.0(API26级)对应用程序在后台运行时可以执行的操作进行了限制。
https://developer.android.com/about/versions/oreo/background
发布于 2019-03-13 06:00:39
你能指定android操作系统的版本吗?因为android:autoVerify="true"只能在Android6.0和更高版本上运行,从而导致系统尝试验证与应用程序的任何意图过滤器中的URL相关联的所有主机。
发布于 2019-03-18 06:09:14
这两个条目对我来说也很奇怪,我不确定您在这里想要实现什么:
<data android:host="ideal-payment" android:scheme="com.company.ideal" />
<data android:host="ideal-payment" android:scheme="com-company-ideal" />
这并不理想,因为这些主机和方案都是无效的,请参见data-element。
我假设,基于所有明显被扣留的代码...其他intent-filter
还可能具有重复的data
元素,需要将这些元素移到单独的intent-filter
中,而activity
元素允许使用多个元素。在所有这些intent-filter
上设置android:autoVerify="true"
,然后在安装包后仔细检查日志。
https://stackoverflow.com/questions/55005186
复制相似问题