Skip to content

Commit 125c386

Browse files
committed
SDK-523 correct Android foreground link behavior
1 parent c5393bf commit 125c386

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/android/io/branch/BranchSDK.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ static class BranchLinkProperties extends io.branch.referral.util.LinkProperties
4848
private Branch instance;
4949
private String deepLinkUrl;
5050

51+
private SessionListener sessionListener;
52+
5153
/**
5254
* Class Constructor
5355
*/
@@ -79,6 +81,7 @@ public void onNewIntent(Intent intent) {
7981

8082
this.activity.setIntent(intent);
8183

84+
this.reInitSession();
8285
}
8386

8487
/**
@@ -284,9 +287,18 @@ private void initSession(CallbackContext callbackContext) {
284287
this.deepLinkUrl = data.toString();
285288
}
286289

290+
this.sessionListener = new SessionListener(callbackContext);
287291
this.instance = Branch.getAutoInstance(this.activity.getApplicationContext());
288-
this.instance.initSession(new SessionListener(callbackContext), data, activity);
292+
this.instance.initSession(this.sessionListener, data, activity);
293+
}
289294

295+
private void reInitSession() {
296+
if (this.sessionListener == null) {
297+
return;
298+
}
299+
300+
this.activity = this.cordova.getActivity();
301+
this.instance.reInitSession(this.activity, this.sessionListener);
290302
}
291303

292304
/**

0 commit comments

Comments
 (0)