Android 分支深度链接未打开应用程序
我正在尝试向我的应用程序添加Branch.io深度链接。我在应用程序中生成的链接重定向到网站,而不是启动应用程序。我注意到,当我手动打开应用程序后,它会导航到我希望通过深度链接打开的活动。我通过Fabric kit添加了Branch.io,并遵循Fabric中关于深度链接路由的逐步教程。我的应用程序还不在Google Play商店中 这是我在网站上的配置(我还选中了选项:Android 分支深度链接未打开应用程序,android,branch.io,Android,Branch.io,我正在尝试向我的应用程序添加Branch.io深度链接。我在应用程序中生成的链接重定向到网站,而不是启动应用程序。我注意到,当我手动打开应用程序后,它会导航到我希望通过深度链接打开的活动。我通过Fabric kit添加了Branch.io,并遵循Fabric中关于深度链接路由的逐步教程。我的应用程序还不在Google Play商店中 这是我在网站上的配置(我还选中了选项:始终尝试打开应用程序和仪表板顶部的测试模式)。我正在生成的链接也应该是test,因为我在BranchSDK:response/
始终尝试打开应用程序
和仪表板顶部的测试
模式)。我正在生成的链接也应该是test,因为我在BranchSDK:
response/request中看到了testkey
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>
主要应用
@Override
public void onCreate(){
super.onCreate();
Fabric.with(this);
Branch.getAutoInstance(this);
}
如果需要,我可以添加更多的代码片段。Alex from Branch.io,请点击此处: 因为当您单击链接后手动启动应用程序时,应用程序会导航到正确的活动,这意味着您的大多数配置都是正确的。唯一似乎缺失的是触发应用程序实际启动的代码 在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>
分支仪表板的一部分
这应该足够让你在这里跑起来了。你可能还想看看我们的网站。Fabric指南是一个很好的入门方式,但它们只涵盖了Branch提供的一小部分功能 如果接受的解决方案不适用于您,请尝试检查顶部的始终尝试打开app
选项。我将生成的链接中的https
更改为http
,它开始工作。这一点很好。我不知道在scheme
字段中写什么。我建议您删除文档中的示例
单词,并添加一个更清晰的字符串,如http://your.example.scheme/for.links
,因为人们会感到困惑,不知道在那里写什么。谢谢
<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>