Branch deeplinking post login

I have 2 activities in my app -Activities A and B. I want to open B via Branch deeplink. But B, will only be shown directly if the user is logged in (this check happens in Activity A).

Now in Branch.initSession in A, Branch automatically routes the deeplink to B, if Branch.isAutoDeeplinkLaunch is true.

  1. How do i control this auto routing? How do I add the constraint that if the user is not logged in, DO NOT deeplink to B directly, just be on A?
  2. If after login, I need to preserve this Branch context, and route again to that appropriate activity (B), how do I achieve this? — Developer
1 Answer(s)
Answered on July 28, 2016.

Hi there!

I think this may be a bit too complex for our isAutoDeeplinkLaunch implementation. You’ll probably want to take a look at the guidelines for building a custom routing method and create something that specifically meets these specifications.

Basically, in activity A, you want to capture all the link data and then extract the parameters you need for deep linking. Then if the user is logged in, pass those params into Activity B. If the user is not logged in, do something else (e.g., show them a log in page). You can even get fancy and save the params through the log in screen so that after logging in, they still get sent to the right place afterwards.

Branch — Developer