android app链接状态未定义

Fei*_* Qu 9 android

我按照这个Android教程(http://developer.android.com/training/app-links/index.html)在我的应用程序中实现应用程序链接功能.但是,当我检查链接策略时adb shell dumpsys package d,它显示在"应用程序验证状态"标题下但状态为"未定义",它根本不会显示在"用户0的应用程序链接"标题下.

我做的是在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>
Run Code Online (Sandbox Code Playgroud)

在我的应用程序中,我使用真正的主机.这个活动是我的应用程序中唯一一个我设置方案和主机的活动.在我的网站上,我添加了这个

[{

    "relation": 

[

    "delegate_permission/common.handle_all_urls"

],
"target": 
{

    "namespace": "android_app",
    "package_name": "mypackage",
    "sha256_cert_fingerprints": 

            [
                "myfingerprint1",
                "myfingerprint2"
            ]
        }
    }

]
Run Code Online (Sandbox Code Playgroud)

我试图通过https://myhost/.well-known/assetlinks.json从浏览器访问它,它可以工作.但是,在我安装应用程序后,等待一段时间然后运行adb shell dumpsys package d,它只是说"未定义".顺便说一下,我在M设备上测试它.

Nic*_*ick 4

对我来说,服务器返回了带有资产链接文件的无效标头。您可以点击以下 URL 来查看您的 assetlink 文件是否有效。只需将 url 中的 example.com 域替换为您的域即可:

https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=http://example.com&relation=delegate_permission/common.handle_all_urls