question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

initSession behavior onPlatformResume and onPlatformReady

See original GitHub issue

Hey,

I used the following code snippet which is called both on platform.ready and in platform.resume.subscribe

    Branch.initSession((data) => {
      alert('initSession Deep Link Data: ' + JSON.stringify(data));
    }).then((res) => {
      alert('Response: ' + JSON.stringify(res))
    }).catch((err) => {
      alert('Error: ' + JSON.stringify(err))
    });

and I observed the following behavior using ionic 3:

  1. When the app starts:
  • a: without clicked deeplink: only Response is called
  • b: with clicked deeplink: BOTH initSession AND Response are called
  1. When the app resumes:
  • a: without clicked deeplink: NOTHING is called
  • b: with clicked deeplink: initSession is called but not Response

My first question is, if this is the intended behavior?

My most pressing question is: If this is the intended behavior: why is nothing called in case 2a? I want to handle this case in my app

A minor question is: If it is the intended behavior: why are 1b and 2b inconsistent?

I am looking forward to your response 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ethanneffcommented, Apr 27, 2018

Hello everybody!

I apologize for the delay. I got pull into another team so the Branch Cordova SDK hasn’t seen much love. The good news is I just updated the Branch Cordova SDK. I would recommend updating to the latest 2.7.0 version. You can use this guide to update the SDK. Keep in mind, this version has a breaking change. The following change will need to be done to your code to read the deep link data. You can find more infomation about reading deep link data here.

  // Branch initialization
- Branch.initSession(function(data) {
+ Branch.initSession().then(function(data) {
    if (data["+clicked_branch_link"]) {
      // read deep link data on click
      alert("Deep Link Data: " + JSON.stringify(data));
    }
  });

Thanks,

1reaction
FlorianWetschoreckcommented, Jan 19, 2018

I would like to stress a small extension to the post of @codinronan

While the .then() helps you in cases, when the app is closed, it does not help you when the app resumes (as I stated in my initial post under scenario 2a).

Thus, you can not find out in a deterministic way if there might be a link clicked or not. The result is, that if you open special content, there will always be a delay until you actually know which content to show. (This delay is caused by the link evaluation by the branch SDK.) In my tests, this delay ranged between 500-1500ms. However, I also tested in cases with bad Internet connection and received the special response after 5000-10000ms which alienated the user.

Summing up, it would help us developers to deliver a seamless experience if the branch SDK could handle all four cases (see my original post) in a deterministic way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

initSession behavior onPlatformResume and onPlatformReady
Hey, I used the following code snippet which is called both on platform.ready and in platform.resume.subscribe Branch.initSession((data) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found