react-native-branch-deep-linking-attribution icon indicating copy to clipboard operation
react-native-branch-deep-linking-attribution copied to clipboard

branch.subscribe does not run on Android when opening from cold start

Open jamieGardyn opened this issue 2 years ago • 4 comments

branch.subscribe works properly once the app is open, in the background, and a deep link is pressed. However, if a deep link is pressed when the app is closed, it does not make it to branch.subscribe method, thus I cannot handle the deep link.

jamieGardyn avatar May 19 '22 00:05 jamieGardyn

There is a comment here on how to handle this. Apparently, branch.subscribe gets triggered too late in Android when the app is opened the first time, therefore, for cold opens you must use branch.getLatestReferringParams()

This is not a great hack, however, and I'd hope there is a fix for this issue on android. After all, branch.subscribe() works properly in all conditions in iOS!

jamieGardyn avatar May 19 '22 16:05 jamieGardyn

So, after following the suggestion on the previous comment, now, it opens from a cold start - but when i click a deep link after the app is already opened, the subscribe method gets hit but it's params show as {"+is_first_session":false,"+clicked_branch_link":false}

jamieGardyn avatar May 24 '22 17:05 jamieGardyn

The answer is that the example and description on Branch for setting up is wrong. This thread, which asks the question of if this is a 'safe' thing to do, actually fixes this problem, and I am not sure how any user has this working with the setup as described by Branch.

jamieGardyn avatar May 24 '22 18:05 jamieGardyn

Is this also related to ``new NativeEventEmitter()was called with a non-null argument without the requiredaddListener method that I believe is being fired when branch.subscribe is being called on Android?

alexpchin avatar Aug 24 '22 14:08 alexpchin