Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ShayShaked opened this issue Apr 26, 2020 · 2 comments

Comments

@ShayShaked
Copy link

ShayShaked commented Apr 26, 2020

Hi,
We're facing a problem with the latest release Cordova 4.1.3 .
When the app is initialized, every resume we get this error what causes the app to work unexpectedly:
error":"Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true.

I saw that the problem occurres also on android-branch-deep-linking-attribution
, Android SDK v4.3.2.
Is there any fix on the way?

env info
Ionic:

Ionic CLI : 5.2.4
Ionic Framework : @ionic/angular 4.7.4
@angular-devkit/build-angular : 0.802.1
@angular-devkit/schematics : 8.2.1
@angular/cli : 8.2.1
@ionic/angular-toolkit : 2.0.0

Cordova:

Cordova CLI : 9.0.0 ([email protected])

Update 15/02/2021
There is an issue with location permission.
When Location permission is Disabled the InitSession runs twice, what cause the Session initialization already happened error. If the Location permission is Enabled the initSession run only once

@PDLMobileApps
Copy link

PDLMobileApps commented Jul 17, 2020

We are facing the same issue with:

Cordova CLI: 9.0.0
cordova-android: 9.0.0
cordova-ios: 6.1.0

@mifkys
Copy link

mifkys commented Jul 22, 2020

Hello! I fixed this issue by replacing SessionListener.onInitFinished() method with next:

public void onInitFinished(JSONObject referringParams, BranchError error) {

            String out;

            if (error == null && referringParams != null) {
                if (this._callbackContext != null) {
                    this._callbackContext.success(referringParams);
                }
            } else {
                // fix ERR_BRANCH_ALREADY_INITIALIZED error
                if (error.getErrorCode() == BranchError.ERR_BRANCH_ALREADY_INITIALIZED) {
                  getLatestReferringParams(this._callbackContext);
                } else {
                    JSONObject message = new JSONObject();
                    try {
                        message.put("error", error.getMessage());
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    if (this._callbackContext != null) {
                        this._callbackContext.error(message);
                    }
                }
            }
        }

MaximBelov added a commit to MaximBelov/cordova-ionic-phonegap-branch-deep-linking-attribution that referenced this issue Apr 21, 2021
…ion, set intent extra, "branch_force_new_session", to true. BranchMetrics#653
fcamblor added a commit to 4sh/cordova-ionic-phonegap-branch-deep-linking-attribution that referenced this issue Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants