Branch.io and Facebook login

Since ionic-plugin-deeplinks isn’t maintained anymore, I’m trying to migrate to branch.io using branch-cordova-sdk as described in GitHub - BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution: The Branch Cordova Ionic Phonegap SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.

It’s working, when I type the url according the uri scheme, I’m forwarded to my app.

Still, I find something weird because I’m using the Facebook4 plugin (cordova-plugin-facebook4).

In the iOS simulator, when I type the url according the uri scheme in the mobile safari browser (like: “myapp://”) my installed app pop up, fine, but when I’ve a look to the console output I see

FB handle url: myapp://

Which means that Facebook plugin intercept each time this uri. It doesn’t have really an effect, nothing unexpected happens, at least it looks like nothing wrong happen, but still, should I be concern about it? If yes, should I implement/configure something to avoid that and how?

P.S.: Except the configuration, right now my code for the deep linking of branch.io is really as simple as described in the doc

 private initializeDeepLinking() {
    this.platform.ready().then(() => {
        if (this.platform.is('cordova')) {
            let Branch = window['Branch'];
            Branch.initSession((data: any) => {
                console.log(data);
            });
        }
    });
}

Ok, so first I should had RTFM :wink:

Universal links doesn’t work when pasted in the iOS/Safari browser. To test correctly, I should have, for example, pasted the link in the notes app and then click on it (keyword: click on the link is mandatory for universal links on iOS) iOS SDK

Then about the msg

FB handle url: myapp://

It looks like it only happens when I directly type/paste a link like myapp://in iOS/Safari browser and well don’t know if it’s bad or not, but it look like it has no effect. I’m guessing that the Facebook plugin intercept it but since it’s not a recognized link, it does nothing with

Well then, without any further thought, I think it looks ok like this and that isn’t a killer which doesn’t allow me to switch from ionic-plugin-deeplinks to branch.io

P.S.: I mark this post as answer because I’m not gonna follow this question furthermore. If you notice something wrong, don’t hesitate to correct me

1 Like

I had contact with the support of branch.io, summarized that shouldn’t be a problem :slight_smile:

P.S.:

myapp:// is a URI scheme and not a universal link. they are not tied to any specific system
universal link are use for deep linking when users click on them

Thanks @reedrichards for all this information. I’m having an issue with the Branch plugin and I think it may be related to this as well.

In our app we also have the facebook and the branch Cordova plugins installed, and we would like to support both universal links (using branch) and also (the old) deep links like foobar://campaign=56 (this may sound strange but we need to support them as well because of the way we create ads to promote our app).

The problem is that when opening a deep link like foobar://campaign=56 on Android, we get that deep link url from Branch’s plugin inside of a property called +non_branch_link, like this:

But when trying to do the same on iOS, that +non_branch_link property is null, and based on this github issue seems like the facebook plugin is getting that deep link (since I can see the log FB handle url: foobar://campaignId=56 in XCode) but then is not allowing Branch to handle it properly.

In your app you didn’t need to support the old deep links, right?

@sebaferreras first of all it’s been a bit of time and it’s always difficult for me to remember all the subtleties of deep linking and custom schema you know, so I gonna try my best ok :wink:

so far I remember, I wrote a PR to update the doc of the ionic deep link plugin…wait for it…there https://github.com/ionic-team/ionic-plugin-deeplinks/pull/140

so according that, if you still want to handle custom scheme like foobar:// you have to or could include the custom scheme plugin to solve that https://github.com/EddyVerbruggen/Custom-URL-scheme

actually when I think about it, I do. I use Branch for all deep linking stuffs (I really replaced every links with Branch links) and custom scheme for a special case (redirection to my app in a login build inside the inappbrowser…don’t judge me)

maybe that’s the path to follow? does that help a bit?

1 Like

… (redirection to my app in a login build inside the inappbrowser…don’t judge me)

hahaha been there, done that!

maybe that’s the path to follow? does that help a bit?

Thanks for such a detailed answer @reedrichards. Of course it helps, and I agree that adding the Custom-URL-scheme plugin may work well, but I think that with Cordova plugins “the less you use, the better” :sweat_smile:.

So I’ve contacted Branch’s support team, and they told me that the Branch plugin should handle both universal links (like https://foo.app.link/bar?campaign=95) and the old deep links (like foobar://campaign/95). Which is true because that works properly when using the Branch ionic3 example app for both Android and iOS.

So I’ve started to compare that example project with our app, and found that there’s a conflict with the Facebook plugin. Basically if you installed the Facebook plugin, Branch won’t be able to get the old deep link (please notice that universal links work properly, this happens only for custom schema/the old deep links).

I’ve created this Github issue on Branch’s repo but in the meantime we’re using a fork of the Facebook plugin where the method that causes the conflict is commented (yay).

I hope this can help some other ionites facing a similar issue! :beers:

1 Like

@sebaferreras awesome, looking forward to the outcome :slight_smile:

note: since a couple of month, it seems that, I’m taking care of the Facebook4 cordova plugin, would be cool if you could keep me updated. If something should be modified in the plugin, don’t hesitate to submit a PR and ping me too :wink:

1 Like