Description
We are getting following error :
io.branch.sdk.android:library: 4.3.2
Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true.
We are using Firebase default Notification messages along with branch.io
Steps to reproduce:
If app is already open and then notification is received, then clicking on it navigates properly to desired deep link page.
But in following scenario it doesnt:
Keep the app closed
Send notification
Open the app
Click on notification
Instead of deeplink, home page is opened
Now exit the app and open again. This time the previous deeplink will be open.
Could you help us how to solve this issue .
Following is the code snippet in extended Application class :
Branch.getAutoInstance(getContext())
In LaunchActivity :
public override fun onStart() {
super.onStart()
//Todo: Check this session initialisation
intent?.putExtra(KEY_NEW_SESSION, true)
Branch.getInstance().initSession(
branchListener, intent?.data, this
)
}
private val branchListener = Branch.BranchUniversalReferralInitListener { branchUniversalObject, linkProperties, error ->
DeepLinkManager.getInstance()?.launchScreen(this, linkProperties, error, isFirstLaunch)
isFirstLaunch = false
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
this.intent = intent
Branch.getInstance().reInitSession(this, branchListener)
}
AndroidManifest.xml :
Launch Activity is android:launchMode="singleTask"