Android应用链接已通过验证。但是,仍然出现消歧对话框

时间:2018-12-18 07:48:04

标签: android

当我单击链接:Android版本6/7/8上的https://example.com/abcd时,显示消歧对话框。我们已经通过将json放在https://example.com/.well-known/assetlinks.json来验证域。我已经按照文档完成了所有操作,但是链接没有歧义不会打开。请帮助我找到我想念的东西。

清单中的代码:

<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="https"
        android:host="example.com"
        android:pathPattern="/abcd"
    />
</intent-filter>

6 个答案:

答案 0 :(得分:4)

迟到聚会了,但我也经历了歧义消隐的现象。对于尚未(或即将解决)此问题的人,请转到Logcat并搜索“ IntentFilterIntentOp”。您应该会看到类似Verification 8 complete. Success:true. Failed hosts:.的错误,这可能会失败(Verifying IntentFilter. verificationId:8 scheme:"https" hosts:"example.co.za" package:"za.co.example.qa".),如果您已将assetlinks.json文件上传到一个域,而在意图中注册的其他域或子域上却无法访问该文件,过滤器。

值得一提的是,您的App必须至少已启动一次,才能使“ IntentFilterIntentOp”执行必要的验证。此后,通过Android Studio中的“应用链接测试”访问链接后,应该会自动打开您的应用,而不会出现歧义消除对话框。

答案 1 :(得分:0)

请尝试添加autoVerify =“ 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="https"
        android:host="example.com"
        android:pathPattern="/abcd"
    />

答案 2 :(得分:0)

您可以尝试使用http和https:

<activity
        android:name=".ui.MainActivity"
        android:launchMode="singleTask"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data
                android:host="www.oschina.net"
                android:scheme="http" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data
                android:host="www.oschina.net"
                android:scheme="https" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data
                android:host="my.oschina.net"
                android:scheme="http" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data
                android:host="my.oschina.net"
                android:scheme="https" />
        </intent-filter>
    </activity>

答案 3 :(得分:0)

此处的警告是,如果您是通过Playstore安装应用的,则默认将注册域名为www.example.com之类的应用的"link-handling policy"设置为“在应用中处理”,这将直接打开应用主题进行意图过滤器验证,而没有任何歧义对话。

如果您通过诸如adb之类的非playstore之类的方式安装应用程序,即使您使用密钥库对其进行了签名,则默认的link handling policy设置为“ Always ask”,即使意图过滤器验证通过,它也会显示歧义对话框为您的应用程序链接。

希望这会有所帮助。

答案 4 :(得分:0)

遇到了同样的问题。看一下您的sha256指纹。如果您使用应用程序的调试版本测试应用程序链接,则必须放置用于调试版本的指纹。您可以在Android Studio-工具-应用链接助手-关联网站中完成此操作。

答案 5 :(得分:0)

在Android Studio上运行应用程序时,会在设备上安装调试APK,该调试APK可能与分支仪表板上的实时配置(用于发布APK或捆绑销售商品)相匹配。

要处理分支中的调试(或测试)模式,这就是我所做的

  1. 在分支仪表板中设置测试配置:

    • 在仪表板上的左上方,有一个用于访问测试模式的开关,单击它并填写测试配置表格。
    • 接下来创建一个调试链接。字段值应与实时(发布)模式链接的值相同。生成的测试链接唯一的区别是包含前缀 yourapp。 test- app.link/xxxxx
  2. 为每种类型的APK或捆绑包创建两个Android清单文件:

    • app/src/debug/AndroidManifest.xml <-用于调试APK或捆绑包
    • app/src/main/AndroidManifest.xml <-用于发布APK或捆绑包
  3. 对两个清单文件都进行Branch SDK设置

您现在应该可以使用调试链接,而不会显示歧义消除提示