动态链接(Android App Links)不提示"open with" Android 6.0+

Dynamic Links (Android App Links) not to prompt "open with" Android 6.0+

如何进行设置,以便动态 Link(来自 Fireabase)直接打开应用程序,而不是首先要求在浏览器或应用程序之间进行选择。

我已经设置了 Firebase Dynamic Links 并将证书指纹 sha256 添加到 firebase 项目设置中。选择任一选项(浏览器或应用程序)将最终打开应用程序,但它仍然会询问。

据我所知,Android App Links 在 Android 6.0 及更高版本上是可能的。

AndroidManifest.xml

中的意图过滤器
<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:host="my-custom-subdomain.page.link" android:scheme="http"/>
             <data android:host="my-custom-subdomain.page.link" android:scheme="https"/>
</intent-filter>

有什么建议吗?

好吧,如果没有显示任何代码就很难说,但要使其起作用,您必须将 intent-filter 中的 android:autoVerify 标记设置为 true

此外,您需要按照以下方向进行部署和 assetlinks.json> https://domain.name/.well-known/ 并且您必须为您的 Intent 过滤器支持的所有域执行此操作。

过程解释的很好here

PD:这是一个 assetlinks.json

的例子
[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
  "namespace": "android_app",
  "package_name": "com.example",
  "sha256_cert_fingerprints":

  ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]
  }
}]

我的问题是在 App Links Assistent 中按下 Link 和验证按钮。

对于其他面临类似问题的人,需要检查的事项:

  • 如果清单中添加了 Intent 过滤器;

  • 如果将corect sha256添加到Firebase项目中;

  • 如果您按下 'Link and Verify button';
  • 如果您使用新的清单卸载并重新安装了该应用程序