【问题标题】:Android Deep Linking - Verify App links with websiteAndroid 深度链接 - 验证应用与网站的链接
【发布时间】:2021-12-27 10:33:55
【问题描述】:

我正在尝试启用与我的应用的深度链接
当我从我的应用程序外部扫描 QR 时,例如使用 QR Scanner 应用程序或在系统中使用 QR 扫描仪,当我选择网络浏览器并使用链接搜索时,它会指向我的应用程序 我添加了代码以显示如下图像:

当我用https://domain.ex/.well-known/assetlinks.json搜索时

并用https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://domain.example&relation=delegate_permission/common.handle_all_urls搜索

我犯了什么错误?

我正在运行一种发布模式,SHA256 来自谷歌游戏控制台。

预期的行为是:当我使用 https://domain.example/pathPrefix 搜索时,它会直接进入我的应用程序

【问题讨论】:

    标签: java android android-studio kotlin


    【解决方案1】:

    我认为需要单独添加方案

    <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="yourdomain.com"
            android:pathPrefix="/prefixpath/" />
    
    </intent-filter>
    

    如果上述步骤都不起作用,请尝试在下面给出的 URL 中更改网站名称,这将显示 SHA256 密钥 google 已被缓存。

    https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://www.your-website-name.com&relation=delegate_permission/common.handle_all_urls

    看到这个How to force Google to refetch .well-known/assetlinks.json in order to fix my Android App Link implementation

    【讨论】:

    • 为什么需要添加?为什么需要分开?
    • 它也不适合我
    • @GeorgeSamuel 我刚刚更正了我的答案。请参阅我的最后一个解决方案。希望有用。
    • 感谢您的帮助,当我将代码推送到谷歌游戏控制台上的内部测试时,代码成功运行,然后下载应用程序,它运行正常。在发布模式下运行代码不足以做出正确的行为。
    最近更新 更多