Azadrum
Azadrum

Reputation: 746

Branch.initSession function is not hit

I am trying to redirect my users to correct page manually if the clicked a branch link to open my app.

I am fairly new to the concept and I don't fully understand the deeplinking, so this maybe wrong way of handling the issue but I am trying it as follows;

I am inside cordova environment, [email protected]

installed branch-cordova-sdk 2.6.15

inside deviceready and resume, I initialize branch docs

document.addEventListener('deviceready', function() {
    branchInit();
}, false);

document.addEventListener('resume', function() {
    branchInit();
}, false);


function branchInit() {
    // Branch initialization
    console.log("branch init")
    Branch.initSession(function(data) { // this function doesn't get called
        console.log("branch init session:")
        console.log(data)
        if (data['+clicked_branch_link']) {
            $location.path(data['$location_path']); // redirect user to correct path
        }
    }).then(function(q) {
        console.log("initSession success");
        console.log(q);
    }).catch(function(e) {
        console.log("initSession error");
        console.log(e);
    });
}

And I create quick links from dashboard (docs). Send them to my phone(whatsapp) and click the links from whatsapp.

Branch opens my app successfully, but user doesn't get redirected to the correct page. And I got following console logs after click,

branch init
initSession success
{+clicked_branch_link: false, +is_first_session: false}

I think, since clicked_branch_link is false, initSession Callback function doesn't get called.

Upvotes: 3

Views: 1039

Answers (1)

Amruta Deshmukh
Amruta Deshmukh

Reputation: 1045

There was a bug on the Branch Cordova SDK v2.6.15 which was causing this issue. Please update your Branch Cordova SDk to 2.6.16.

Here are the release notes/comments: https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking/issues/384#issuecomment-340621951

Upvotes: 2

Related Questions