Branch link and lifecycle callbacks
I am using Branch to Deeplink to an Activity in my app. This activity is NOT the splash activity. I have added the intent filter and the metadata tag to that particular activity in the Androidmanifest.
Normal app flow – In the onCreate() of the activity, I get data from Intent and use that data ahead in the activity. I want this same thing to happen in case of deeplink too.
Branch flow –
what i have done
- onStart() –> I init a Branch session.
- onResume() –> I check for Branch.isAutoDeeplinkLaunch(this)
- onNewIntent()–> setIntent(intent) . Marked activity as SingleTop in Manifest
What happens when a Branch deeplink is clicked from Whatsapp. (It should ideally deeplink to this activity in the app)
What actually happens –
- Calls onCreate()
- Calls onStart(). Starts initing the session.
- Before initSession() callback is called, onResume() is called. Here, now Branch.isAutoDeeplinkLaunch returns false
- onInitSession() callback is now called. I get my referringParams.
- onPause() is now called
- onNewIntent() is called
- onStart() is again called. Here again init() happens. And i get the callback then and there. No delay
- onResume() gets called. Here, now Branch.isAutoDeeplinkLaunch returns true!
I have followed the documentation, but somewhere it seems vague and confusing. Any help?
This sounds like a more in-depth technical question, and would be better for our Integrations team. Could you send them a ticket? They’ll be able to help out.