如何在 React.js Cordova 应用程序上调用 Branch 侦听器
我正在 Cordova 框架中使用 React.js 应用程序。
由于文档不太清楚,我想了解如何在我的应用程序中调用 Branch.io 侦听器,以便我可以捕获单击 Branch.io 链接的位置、由谁单击以及单击的确切 URL。必须有一种方法可以从 React 本身调用 Branch.io 事件(否则,你如何监听应用程序内部的事件?)。我在我的 index.js
文件中尝试了以下内容,但没有成功,因为 React 应用程序的构建失败(因为 cordova 仅在运行时可用)。
从“branch-cordova-sdk”导入{Branch}
任何帮助将不胜感激!提前致谢!
I am using a React.js app in a Cordova framework.
As the docs are not really clear, I would like to understand how to call a Branch.io listener in a my app, so that I can capture where the Branch.io link was clicked, by whom and what exact URL was clicked. There must be a way to call the Branch.io events from React itself (otherwise, how can you be listening to the event inside the app?). I tried the following in my index.js
file but was not successful because the build of the React app failed (as cordova is only available during runtime).
import {Branch} from "branch-cordova-sdk"
Any help would be appreciated! Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于到达此页面的其他人:
如果您尝试在 React.js 应用程序(非 React Native)中生成和访问 Branch.io 的分支,并且您已将其嵌入到 Cordova 应用程序中,则必须遵循以下文档:< a href="https://help.branch.io/developers-hub/docs/web-basic-integration" rel="nofollow noreferrer">https://help.branch.io/developers-hub/docs/web -基本集成
作为快速要点:
index.html
文件中调用分支,如文档中所述:只需定义您的内容想要从那里开始处理你的分支。
For anybody else arriving at this page:
If you are trying to generate and access branches from Branch.io in your React.js app (not React native) and you have embedded it into a Cordova app, you have to follow these documentation: https://help.branch.io/developers-hub/docs/web-basic-integration
As quick bullet points:
index.html
file, as mentioned in the docs:Just define what you want to do with your branch from there onwards.