Intent Filter with android:autoVerify=quot;truequot; - never verified at installation, default app links don#39;t work(使用Android的意图过滤器:AutoVerify=;TrueQuot;-安装时从未验证,默认应用程序链接不起作用)
本文介绍了使用Android的意图过滤器:AutoVerify=&;True&Quot;-安装时从未验证,默认应用程序链接不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在我的Android应用程序中使用Branch.io SDK,并希望使我的应用程序成为Android 6上分支链接的默认处理程序,here(Android指南)和here(Branch.io指南)
这是我的活动在androidManifest.xml中的声明:
<activity android:name="com.mypackage.MyActivity"
android:launchMode="singleTask">
<intent-filter tools:node="merge" android:autoVerify="true">
<data android:scheme="@string/url_scheme" android:host="open"/>
<data android:scheme="https"
android:host="@string/branch_io_host"
android:pathPrefix="@string/branch_io_path_prefix"/>
<data android:scheme="http"
android:host="@string/branch_io_host"
android:pathPrefix="@string/branch_io_path_prefix"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
但是,当我在设备上安装内部版本时,当我单击具有正确主机和路径的链接时,仍然会看到选择器对话框。在阅读了extensive guide on app linking之后,我相信这是因为我的设备从未验证我的应用程序的意图过滤器。例如,当我从Play Store安装Twitter应用程序时,我在LogCAT中看到以下消息:
03-24 15:04:27.231: D/IntentFilterVerificationReceiver(16965): Received ACTION_INTENT_FILTER_NEEDS_VERIFICATION.
03-24 15:04:27.248: I/IntentFilterIntentService(16965): Verifying IntentFilter. verificationId:2 scheme:"https" hosts:"twitter.com www.twitter.com ads.twitter.com" package:"com.twitter.android".
03-24 15:04:30.134: I/IntentFilterIntentService(16965): Verification 2 complete. Success:true. Failed hosts:.
但我在安装应用程序时没有看到这样的消息。我尝试了发布和调试版本,尝试将其上传到Play商店中的Alpha测试,并从那里安装,结果相同。为什么Android不验证我的意图过滤器?
推荐答案
已通过将此数据标记移动到单独的意图筛选器修复此问题:
<data android:scheme="@string/url_scheme" android:host="open"/>
现在的androidManifest是这样的:
<activity android:name="com.mypackage.MyActivity"
android:launchMode="singleTask">
<intent-filter tools:node="merge" android:autoVerify="true">
<data android:scheme="https"
android:host="@string/branch_io_host"
android:pathPrefix="@string/branch_io_path_prefix"/>
<data android:scheme="http"
android:host="@string/branch_io_host"
android:pathPrefix="@string/branch_io_path_prefix"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
<intent-filter>
<data android:scheme="@string/url_scheme" android:host="open"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
来自IntentFilter的消息现在按预期显示在日志中。
这篇关于使用Android的意图过滤器:AutoVerify=&;True&Quot;-安装时从未验证,默认应用程序链接不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
织梦狗教程
本文标题为:使用Android的意图过滤器:AutoVerify=&;True&Quot;-安装时从未验证,默认应用程序链接不起作用
基础教程推荐
猜你喜欢
- AdMob 广告未在模拟器中显示 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
