Help adding Branch Metrics SDK to Ionic app


#1

Hi everyone,

I started creating an Ionic mobile app without any experience with Cordova nor AngularJS (I do have native iOS experience and some NodeJS) so I’ve got some newbie questions that I googled far and wide but haven’t been able to find out.

I was able to build a simple app with a few screens and test it on iOS Simulator and on the actual device via Testflight. All of that was really easy.

But now I’m trying to add Branch Metrics and their Cordova SDK to the app and I can’t get that to work at all. I found some blog posts, browsed some examples on Github, but I couldn’t find a complete example that doesn’t omit the basics

So I ran:

cordova plugin add --link https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK.git --variable BRANCH_KEY=[key here] --variable URI_SCHEME=[scheme here]

And I see that ios.json got updated to reference the io.branch.sdk, but I can’t figure out how to add that plugin to the app.

From what I’ve gathered I need to:

  1. Add a reference to the branch sdk’s js file in the app’s index.html page
  2. Register the plugin in the app.js in the “angular.module(‘app’, [‘ionic’, …])” call

But I have now idea how to do that, what’s the path and name of the js file? What’s the name of the module to register?

Thanks,
Alex