android 应用程序链接状态未定义

标签 android

我按照这个 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 域替换为您的:

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

关于android 应用程序链接状态未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35517688/

相关文章:

android - "Error: String types not allowed (at ' configChanges ' with value ' 键盘|键盘隐藏| orien"... 在 AndroidManifest.xml 中

android - Android Plugin for Gradle 中的 "minifyEnabled"和 "useProguard"有什么区别?

android - 从 AsyncTask 检索对象值

Android actionBar OnClick()

c# - Xamarin.Android 中基于 RESX 的本地化

android - 如何在 Android 11 中打开自定义图库

java - 在 Android 中使用 POST 方法发送参数

android - 在 Android Studio 项目上运行 gifImageView

Android 设备 (GPS) 方向

Android Realm 数据库不更新记录