首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用branch.io为android创建deeplinks

如何使用branch.io为android创建deeplinks
EN

Stack Overflow用户
提问于 2016-10-24 07:57:18
回答 1查看 3.2K关注 0票数 0

我们正试图为使用branch.io的安卓系统创建一些深层次的链接,但在过去的两天里没有取得任何成功。如果我们能在如何做这件事上得到一些帮助,我们会非常高兴的。

配置:

Android宣言:

代码语言:javascript
复制
<activity
    android:name=".login.view.DeepLinkActivity"
    android:screenOrientation="portrait"
    android:theme="@style/AppTheme.Login"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <data android:scheme="myapp" android:host="open" />
        <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仪表板:

在android重定向部分中,"Android模式“的值设置为"myapp://”

该链接是通过branch.io HTTP生成的。职位要求是

代码语言:javascript
复制
host: v1/url
request body:

{
    "alias":"xxxx",
    "data":"{\"$fallback_url\":\"www.xxx.com\",\"$android_depplink_path\":\"myapp://open/\"}",
    "branch_key":"key_test_xxxxxxxxxx"
}

每当我们试图通过电子邮件打开这个链接,我们就被重定向到在branch.io仪表板中定义的回退网址。

请帮助我们把这个配置正确。

EN

回答 1

Stack Overflow用户

发布于 2016-11-13 08:37:36

您需要重写启动程序ActivityActivity方法,并根据从意向传递的数据处理重定向。

步骤1:使用https://dev.branch.io/getting-started/creating-links/apps/android/#generate-the-link生成深度链接

步骤2:处理意图并采取所需的活动https://dev.branch.io/getting-started/deep-link-routing/guide/android/#building-a-custom-deep-link-routing-method

不要忘记在android:launchMode="singleTop"声明中添加Activity,一次只有一个实例。您还可以使用intent.addFlag()传递Intent.FLAG_ACTIVITY_REORDER_TO_FRONTIntent.FLAG_ACTIVITY_CLEAR_TOP来处理这个问题。希望这能有所帮助。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40213328

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档