应用程序链接无法在Android中按预期方式工作

时间:2019-11-06 11:41:25

标签: android deep-linking android-app-links

我们想要一个应用程序链接。

我们在清单中设置了intent-filter,如下所示:

<intent-filter android:autoVerify="true">
    <data
        android:host="www.we.cards"
        android:pathPrefix="/wecards/"
        android:scheme="https" />

    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

</intent-filter>

有一个代码可以处理相关活动中的意图。 也已在android studio应用链接助手中进行了验证,如下所示:

enter image description here

它映射到如下所示的正确活动:

enter image description here

该活动还具有处理意图的代码。

但是,单击URL而不是直接打开应用程序-我们将看到一个对话框,以选择一个列出应用程序的选项。

我们希望直接重定向应用,而不会出现此类对话框。

enter image description here

如果您有任何解决方案,请尽量详细阐述。

1 个答案:

答案 0 :(得分:0)

由于所有浏览器应用程序中都使用了android:scheme="https",因此应用程序链接按预期方式工作,并且在提供的应用程序列表中都可以看到它们。要实现预期的重定向,您必须使用唯一的方案,例如android:scheme="cards",因此链接应看起来像cards://www.we.cards/wecards/,但是如果这种情况不可接受,则可以使用Firebase Dynamic Link。这是一个功能强大的工具,可以重定向到应用程序或游戏市场