我定义我的应用程序链接如下AndroidManifest.xml:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:host="mysite.com" android:scheme="http"/>
<data android:host="mysite.com" android:scheme="https"/>
<data android:host="www.mysite.com" android:scheme="http"/>
<data android:host="www.mysite.com" android:scheme="https"/>
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
该应用程序正确地检测到来自主机的 URL,但会提示用户是否要在应用程序或浏览器中打开它们,因为验证失败,如 Android 监控控制台所示:
01-17 15:44:28.847 7084-30015/? I/IntentFilterIntentSvc: Verifying IntentFilter. verificationId:2 scheme:"https" hosts:"mysite.com www.mysite.com" package:"com.site.myapp.android.flavor".
01-17 15:44:29.821 7084-30015/? I/IntentFilterIntentSvc: Verification 2 complete. Success:false. Failed hosts:mysite.com,www.mysite.com.
Run Code Online (Sandbox Code Playgroud)
我的 assetlinks.json 文件位于mysite.com/.well-known/assetlinks.json并包含正确的包名称和 SHA256 哈希值。它也可以通过 http 和 https 访问。我已经通过从 APK 中提取 CERT.RSA 文件并使用keytool -printcert -file CERT.RSA
我曾尝试调用https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://domain1:port&relation=delegate_permission/common.handle_all_urls以及使用谷歌站点语句列表测试器,并且都返回 OK。
我正在使用运行 Android 7 的 Nexus 设备进行测试。 …