Android: Intent 过滤器验证失败
Android: intent filter verification failure
我的目标是让 Android 在我的应用程序中自动打开任何以 test.touchwonders.com
开头的 link。我已将所需文件放在我的服务器上:https://test.touchwonders.com/.well-known/assetlinks.json
这是我清单的相关部分:
<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
我真正的问题是我没有测试我的 assetlinks 文件的方法。同时我找到了一个:
参考https://developer.android.com/training/app-links/index.html#testing
并使用测试 url
https://digitalassetlinks.googleapis.com/v1/statements:list?
source.web.site=https://<domain1>:<port>&
relation=delegate_permission/common.handle_all_urls
我遇到了同样的问题,但问题与 assetlinks.json 文件无关。我有 3 个不同的域,其中一个域由于配置错误而失败。即使只有一个域出现故障,applink 也不适用于其他域。您可能需要检查所有域是否都按预期工作。
我的目标是让 Android 在我的应用程序中自动打开任何以 test.touchwonders.com
开头的 link。我已将所需文件放在我的服务器上:https://test.touchwonders.com/.well-known/assetlinks.json
这是我清单的相关部分:
<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
我真正的问题是我没有测试我的 assetlinks 文件的方法。同时我找到了一个:
参考https://developer.android.com/training/app-links/index.html#testing
并使用测试 url
https://digitalassetlinks.googleapis.com/v1/statements:list?
source.web.site=https://<domain1>:<port>&
relation=delegate_permission/common.handle_all_urls
我遇到了同样的问题,但问题与 assetlinks.json 文件无关。我有 3 个不同的域,其中一个域由于配置错误而失败。即使只有一个域出现故障,applink 也不适用于其他域。您可能需要检查所有域是否都按预期工作。