Branch.io在Android中的深度链接会打开Play Store,即使没有相关内容。

13

无论如何,当我点击使用 branch.io 创建的链接时,用户总是跳转到 Google Play :-((

这是清单中相关的活动:

<activity
        android:name=".activities.DetailActivity"
        android:configChanges="keyboard|screenSize|orientation"
        android:screenOrientation="portrait">
        <intent-filter>
            <data
                android:host="open"
                android:scheme="foo" />
            <action android:name="android.intent.action.VIEW" />

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

这是branch.io的仪表盘:

输入图片描述

3个回答

7

Android 延迟深度链接 SDK README中可以看到:

为什么 Chrome 一直带我去 Google Play?

Chrome 对直接打开应用程序非常挑剔。Chrome 使用意图系统尝试打开应用程序,但很容易退回到 Play 商店。有三件事需要验证:

  1. 确保测试构建的包名称与 Branch 设置中注册的包名称和 Google Play 中的包名称匹配。

  2. 确保测试构建的 URI 方案与 Branch 设置匹配。

  3. 验证您已在清单中添加了适当的主机“open” - 参见这里

我注意到你使用这个应用程序作为示例。请检查您的应用程序的包名称是否为com.foo.inappbilling,否则Branch.io链接将无法打开您的应用程序并始终打开 Google Play 商店。

我能够重现您的问题并通过设置正确的包名称来解决问题。如果您使用 Gradle,则可以直接从app/build.gradle中执行此操作:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.foo.inappbilling"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    ...

有一件事需要补充,“选择基于此URI方案的现有路由支持”。如果是这种情况,foo://将会打开+为键$deeplink_path指定的任何内容。因此,$deeplink路径将需要bar! - Sahil Verma
@Mattia Maestrini:我们一定要把“host”设置为“open”,还是我们可以使用任何关键词? - anticafe

1

您是否在方案定义上方的链接设置中的仪表板中检查了“始终尝试打开应用程序”?还要确保清单中设置的方案没有“://”,请参阅@inverce答案获取更多说明。


1
在仪表板设置/链接设置中,选择自定义URL并输入您的应用程序包名称。

这根本行不通,而且完全正确,因为包名不是一个URL。 - Shivam Bhalla
没有包名,就无法通过URL打开应用程序,在我的应用程序中这个功能完美运作。 - Siddharth Vanakudari

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接