我按照这个 android 教程 ( http://developer.android.com/training/app-links/index.html ) 在我的应用程序中实现应用程序链接功能。但是,当我使用 adb shell dumpsys package d
检查链接策略时,它显示在“App verification status”标题下,但状态为“undefined”,它没有显示在“App linkages for user”下0" header 。
我所做的是在 AndroidManifest.xml 中:
<activity
android:name=".activities.SplashActivity"
android:label="@string/app_name"
android:noHistory="true" >
<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" android:host="myhost" />
<data android:scheme="https" android:host="myhost" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
在我的应用程序中,我使用真实主机。这个 Activity 是我设置方案和主机的应用程序中唯一的一个。 在我的站点中,我添加了这个
[{
"relation":
[
"delegate_permission/common.handle_all_urls"
],
"target":
{
"namespace": "android_app",
"package_name": "mypackage",
"sha256_cert_fingerprints":
[
"myfingerprint1",
"myfingerprint2"
]
}
}
]
我尝试使用 https://myhost/.well-known/assetlinks.json 从浏览器访问它, 有用。
但是,在我安装该应用程序后,稍等片刻并运行 adb shell dumpsys package d
,它只是显示“未定义”。顺便说一句,我正在 M 设备上对其进行测试。
最佳答案
对我来说,服务器在 assetlink 文件中返回了一个无效的 header 。您可以点击以下网址查看您的 Assets 链接文件是否有效。只需将 url 中的 example.com 域替换为您的:
关于android 应用程序链接状态未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35517688/