React-native-branch-deep-linking-attribution: Subscribe is run twice on android with error

Created on 30 Apr 2020  路  8Comments  路  Source: BranchMetrics/react-native-branch-deep-linking-attribution

This seems to be a regression that's related to https://github.com/BranchMetrics/react-native-branch-deep-linking-attribution/issues/79

We get the following error on android:

Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true.

We're wondering if this causes multiple callbacks to fire in some cases, because we've seen this happen where a navigation event is triggered multiple times by a branch deeplink.

We're using "react-native-branch": "^5.0.0-beta.1"

Most helpful comment

Hi, i am not calling RNBranchModule.reInitSession(this); in my code and yet this error is happening for me on Branch v5.0
This happens when i click on the app notification while the app is still in foreground

All 8 comments

Are you calling reInitSession anywhere, e.g. in Activity.onResume? The solution may be just don't call reInitSession. I need to clean that up in the docs.

If you continue to have trouble, could you please contact [email protected] to open a ticket? We can help you get sorted out there.

Yes we are calling it in MainActivity.java:

// Override onNewIntent for branch:
    @Override
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        RNBranchModule.reInitSession(this);
    }

So I can just remove this block completely?

No, just remove reInitSession. The other things are necessary.

Okay, replacing the above block with this then:

// Override onNewIntent for branch:
    @Override
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
    }

Confirmed that it's now working, thanks @jdee :)

Docs have now been updated as well.

Hi, i am not calling RNBranchModule.reInitSession(this); in my code and yet this error is happening for me on Branch v5.0
This happens when i click on the app notification while the app is still in foreground

Any luck with this guys?

Was this page helpful?
0 / 5 - 0 ratings