I initialize the Branch instance as indicated by the Branch guide.
In my launcher activity, I have the following:
public void onStart() {
super.onStart();
Branch branch = Branch.getInstance();
branch.initSession(new Branch.BranchReferralInitListener(){
@Override
public void onInitFinished(JSONObject referringParams, BranchError error) {
if (error == null) {
...
It works fine when the user first opens the app. However, if the user backs out of the app, and then re-launches the app (so the app stays in memory; ie: the Application class onCreate is NOT called again), then things don't work as expected. The launcher activity is recreated and onStart
is called, but the onInitFinished
is never called again.
Any ideas on how to handle this situation?
Note: I'm using the latest branch release:
compile ('io.branch.sdk.android:library:2.+') {
exclude module: 'answers-shim'
}