gpt4 book ai didi

Android: Intent 过滤器验证失败

转载 作者:行者123 更新时间:2023-12-01 16:03:47 27 4
gpt4 key购买 nike

我的目标是让 Android 自动打开任何以 test.touchwonders.com 开头的链接。在我的应用程序中。我已经在我的服务器上放置了所需的文件:https://test.touchwonders.com/.well-known/assetlinks.json
这是我的 list 的相关部分:

    <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.justbrands.highstreet.pmelegend.PmeApplication">
<activity
android:name="com.highstreet.core.activity.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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:scheme="http" />
<data android:scheme="https" />
<data android:host="test.touchwonders.com" />
<data android:host="www.test.touchwonders.com" />
</intent-filter>

<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:scheme="pme-legend"/>
</intent-filter>

</activity>
</application>

然而,在安装应用程序时,这是我在 logcat 中看到的输出:
06-27 09:48:43.267 6488-6488/? D/IntentFilterVerRcvr: Received ACTION_INTENT_FILTER_NEEDS_VERIFICATION.
06-27 09:48:43.276 6488-8080/? I/IntentFilterIntentSvc: Verifying IntentFilter. verificationId:14 scheme:"https" hosts:"test.touchwonders.com www.test.touchwonders.com" package:"com.justbrands.highstreet.pmelegend.acceptance".
06-27 09:48:43.531 6488-8080/? I/IntentFilterIntentSvc: Verification 14 complete. Success:false. Failed hosts:test.touchwonders.com,www.test.touchwonders.com.

我的设备使用 Charles 代理,它允许您查看请求。我看不到对 test.touchwonders.com 的要求很严格。我用了 adb shell pm clear com.android.statementservice在安装之前,它应该已经清除了缓存并强制重新获取 json。

最佳答案

原来问题不在我的应用程序中,而是在网站服务器上的assetlinks.json 文件中。就我而言,问题在于服务器响应的 MIME 类型不是 application/json。我真正的问题是我没有测试 Assets 链接文件的方法。我在此期间找到了一个:

引用 https://developer.android.com/training/app-links/index.html#testing

并使用测试网址

https://digitalassetlinks.googleapis.com/v1/statements:list?
source.web.site=https://<domain1>:<port>&
relation=delegate_permission/common.handle_all_urls

关于Android: Intent 过滤器验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38048936/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com