android - 使用 Ionic 5 和电容器设置 BranchIo
问题描述
我正在从 Ionic 3 迁移到 Ionic 5,从 Cordova 迁移到 Capacitor。我在使用在 Ionic 3 中完美运行的 BranchIo 插件时遇到了问题。我已经按照本文档安装了 Capacitor 插件,其中包含以下内容。
npm install branch-cordova-sdk
npm install @ionic-native/branch-io
ionic cap sync
安装没有错误。现在我不能按照 Cordova 的这个文档,因为我正在使用电容器。因此,我正在尝试按照Android Basic Integration 的此分支文档在 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>
除此之外,我添加的任何建议代码都会出错。<application>
就像在中添加以下行AndroidManifest.xml
android:name="com.eneff.branch.example.android.CustomApplicationClass"
谁能提供使用 Ionic 5 和电容器设置 BranchIo 的指导?
注意:我也尝试使用 Capacitor 社区插件电容器-branch-deep-links,但是这个插件只有监听链接的方法,没有创建链接的方法。
更新:
我能够获取由 Branch 方法创建的链接,createBranchUniversalObject
但链接未格式化。我得到以下完整链接。
https://bnc.lt/a/key_test_xxxxxx?feature=share&type=0&duration=0&source=android&data=xxxxxx
此链接也打开了正确的页面。唯一不起作用的部分是链接不是短分支链接的转换器。
解决方案
一个分店在这里 -
目前我们有一张内部票可以为 Capacitor 提供支持,但还没有截止日期。对于 Cordova SDK,您可以参考我们的文档 - https://help.branch.io/developers-hub/docs/cordova-phonegap-ionic
对于 Capacitor,我们确实有功能请求,但没有设置时间线。也可以通过 Github issue 进行参考——https: //github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/issues/528 </p>
虽然还有一个社区插件可供您参考,但它不是官方的,可能会导致未知问题。
我会随着未来的 SDK 开发更新这篇文章。
推荐阅读
- python - 为什么德国元音变音字母没有在 Python 中正确打印?
- html - 动态 HTML/CSS 按钮
- java - 将 SQL 查询放入 CrudRepository 以限制列(以及此后的进一步 SQL 查询)
- node.js - Visual Studio Code:部署到天蓝色似乎可以工作,但似乎没有文件传输
- python - 如何在 Python Click 中将选项的默认值设置为另一个参数?
- react-native - React Native modal - 通过滑动关闭时触发功能
- joomla - 删除过时的 Joomla 菜单类型
- angular - 使用 Angular 材质表过滤
- docker - 使用 Docker 从 Travis 迁移到 GitLab CI
- shell - 在 Jenkins 中,同时将 shell 脚本打印到控制台日志和文件