react-native-branch-deep-linking-attribution
react-native-branch-deep-linking-attribution copied to clipboard
branch.subscribe does not run on Android when opening from cold start
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.
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!
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}
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.
Is this also related to ``new NativeEventEmitter()was called with a non-null argument without the required
addListener method
that I believe is being fired when branch.subscribe is being called on Android?