Using branch.io with Meteor

痴心易碎 提交于 2019-12-23 03:29:12

问题


We've been trying to integrate branch.io into our Meteor app, but so far, we are stuck on step 1.

Trying to follow https://start.branch.io/#/integrate-sdk/steps , under "Cordova", we've been unable to install the Cordova plugin successfully. We've tried various commands, including:

meteor add cordova:branch-cordova-sdk@2.0.2
meteor add cordova:io.branch.sdk@https://github.com/BranchMetrics/tarball/a30665d8b12896d1aad9ee0beb42c516e5fc1f6c
meteor add cordova:io.branch.sdk@https://github.com/BranchMetrics.git#a30665d8b12896d1aad9ee0beb42c516e5fc1f6c

as instructed here How to add cordova plug that haven't registration on plugins.cordova.io? for plugins not registered on plugins.cordova.io, even though this one does appear to be (see https://www.npmjs.com/package/branch-cordova-sdk ).

All of these commands cheerfully claim to have added the plugin to Meteor, but when debugging, we consistently find that "branch" is undefined. It would therefore seem that nothing has been installed at all. In fact, it doesn't seem to matter much what one puts after "meteor add cordova:"... Meteor will claim to have added a plugin, which will be visible when one does "meteor list". E.g.:

$ meteor add cordova:kakakak@1.0.0
Added Cordova plugin kakakak@1.0.0.

So... it's pretty hard to tell if anything is actually being done.

EDIT:

The correct command was simply the first one:

meteor add cordova:branch-cordova-sdk@2.0.2

Of course, the "branch" variable would only be defined when the app is running on a device, not in Chrome on the desktop.

Also, it was necessary to add to mobile-config.js the following lines:

App.configurePlugin("branch-cordova-sdk", {
    URI_SCHEME : <the URI scheme that was defined when Branch was setup>,
    BRANCH_LIVE_KEY : <key obtained from the Branch.io dashbaord / settings>
});

Now, we can...

meteor run android-device

which results in :

<appdir>/.meteor/local/cordova-build/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml:62:
error: No resource identifier found for attribute 'autoVerify' in package 'android'

This despite having modified cordova-build-override/AndroidManifest.xml according to https://dev.branch.io/getting-started/universal-app-links/guide/adobe/?search=pathPrefix#add-intent-filter-to-manifest ... but we appear to be confronting this same issue again:

https://github.com/meteor/meteor/issues/5840#issuecomment-186184372

It seems that Meteor ignores our override file, and instead uses the AndroidManifest.xml that is generated by the build.

So... any advice? Has anybody found a way to override the AndroidManifest.xml successfully??


回答1:


My apologies for leading you astray in this issue — I missed that you're developing in Meteor, and after looking into things further, it turns out that the Branch.io Cordova SDK is actually not yet officially compatible with the Meteor stack. There have been a couple of requests for it recently, so I'll pass this along as something to consider supporting officially in future.

If you do have any luck with the Cordova SDK based on the results from that GitHub issue, please let me know!



来源:https://stackoverflow.com/questions/35914927/using-branch-io-with-meteor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!