我正在从Ionic 3迁移到Ionic 5,从Cordova迁移到电容器。我在使用BranchIo插件时遇到了问题,它在Ionic 3中运行得很好。我已经根据本文档安装了电容器的插件,如下所示。
npm install branch-cordova-sdk
npm install @ionic-native/branch-io
ionic cap sync
安装过程中没有错误。现在,我不能为Cordova遵循此文档,因为我正在使用电容器。因此,我正试图根据Android Basic Integration的Branch文档在Adroid Studio中设置我的原生应用程序。
我能够在AndroidManifest.xml
文件中添加的唯一一个没有错误的代码如下。
<!-- Branch init -->
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_xxxxxxxx" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_xxxxxxxx" />
<meta-data android:name="io.branch.sdk.TestMode" android:value="true" />
<!-- Branch App Links (optional) -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="xxxx.app.link" />
<data android:scheme="https" android:host="xxxx-alternate.app.link" />
</intent-filter>
除此之外,我添加的任何建议代码都会出错。类似于在AndroidManifest.xml
的<application>
中添加以下行
android:name="com.eneff.branch.example.android.CustomApplicationClass"
有人能为使用Ionic 5和电容器建立BranchIo提供指导吗?
注意:我也尝试过使用电容器社区插件电容器分支深度链接,但这个插件只有监听链接的方法,没有创建链接的方法。
更新:
我可以获得Branch方法createBranchUniversalObject
创建的链接,但该链接没有格式化。我得到以下完整链接。
https://bnc.lt/a/key_test_xxxxxx?feature=share&type=0&duration=0&source=android&data=xxxxxx
此链接也打开了正确的页面。唯一不起作用的部分是链接没有转换为短分支链接。
这里的分支机构-
目前,我们有一张内部票来为电容器提供支持,但还没有截止日期。对于Cordova SDK,您可以参考我们的文档-https://help.branch.io/developers-hub/docs/cordova-phonegap-ionic
对于电容器,我们确实有一个功能请求,但没有时间表。您也可以浏览Github问题以供参考-https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/issues/528
虽然也有一个社区插件,你可以参考,但它不是官方的,可能会导致未知的问题。
我会在这篇文章中不断更新SDK的未来发展。