gpt4 book ai didi

android - Branch Deep Link 打不开应用

转载 作者:搜寻专家 更新时间:2023-11-01 09:40:48 24 4
gpt4 key购买 nike

我正在尝试将 Branch.io 深层链接 添加到我的应用程序中。我在应用程序内部生成的链接重定向到网站而不是启动应用程序。我注意到,当我之后手动打开应用程序时,它会导航到我想通过深度链接打开的 Activity 。我通过 Fabric 工具包添加了 Branch.io,并按照 Fabric 中有关深度链接路由 的分步教程进行操作。我的应用程序尚未在 Google Play 商店中。

那是我在网站上的配置(我还检查了选项:始终尝试打开应用程序 和仪表板顶部的测试 模式)。我生成的链接也应该进行测试,因为我在 BranchSDK: response/request

中看到了 test key

http://imgur.com/a/mgLgu

AndroidManifest.xml

    <application
android:name=".app.MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<meta-data
android:name="io.branch.sdk.TestMode"
android:value="true" />
<meta-data
android:name="io.branch.sdk.BranchKey"
android:value="key_live_xxx" />
<meta-data
android:name="io.branch.sdk.BranchKey.test"
android:value="key_test_xxx" />

<activity
android:name=".ui.main.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<intent-filter>
<data
android:host="open"
android:scheme="example" />
<action android:name="android.intent.action.VIEW" />

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

构建.gradle

//...
applicationId "com.example"
//...
compile('io.branch.sdk.android:library:2.4.3@aar') {
transitive = true;
}

主应用

@Override
public void onCreate(){
super.onCreate();
Fabric.with(this);
Branch.getAutoInstance(this);
}

如果需要,我可以添加更多代码 fragment 。

最佳答案

来自 Branch.io 的 Alex:

因为当您在单击链接后手动启动应用时应用会导航到正确的 Activity,这意味着您的大部分配置都是正确的。唯一似乎缺失的部分是触发您的应用程序实际启动的代码。

在 Android 上,Branch 为此使用您的 URI 方案。即这段代码:

<intent-filter>
<data
android:host="open"
android:scheme="example" />
<action android:name="android.intent.action.VIEW" />

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

您需要用其他自定义字符串替换 android:scheme="example" 部分中的 example 值。然后确保在 Link Settings 中有相同的字符串(加上 ://) Branch 仪表板的一部分。

这应该足以让您在此处启动并运行。您可能还想查看我们的 full developer documentation . Fabric 指南是入门的好方法,但它们只涵盖了 Branch 可用功能的一小部分!

关于android - Branch Deep Link 打不开应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39980842/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com