0

I have integrated the brach.io deep linking implementation in one of my application in android and made the launcherMode to "singleTask" for launcher/Main activity. The problem here is when i tap on branch link its clearing the stack to launcherActivity and adding the branch data handling activity on top of it.

Example:

  • A is the root/laucher activity with singleTask.
  • C is performing some operation based on the branch data.
  • From A i moved to B.
  • Minimized the app and tapped on branch link.
  • Its opening the app and clears activity B from stack and adding new activitiy C instead of adding activity C on top of activity B.

  • if i change the launcher mode other than singleTask to activity A creating multiple instances of the app.

san
  • 43
  • 5

1 Answers1

0

Please refer to a similar discussion in this post.

Unfortunately, this is default Android behavior. Also, please note that it is important to define the launchMode for the deep linking Activity to singleTask to avoid multiple instances of the app.

PS: You can refer to the reference documentation for the Branch Android SDK integration here.

Amruta Deshmukh
  • 985
  • 5
  • 10
  • Thanks for response, is there a possibility to add the activity on top of same stack? – san Dec 14 '17 at 05:44
  • @san I don't think there is. This is unfortunately default behavior with singleTask. If an Activity (defined as singleTask) is available in the Activity stack and the same activity is called again, all of the Activities placed above that singleTask Activity would be automatically destroyed in the proper way (lifecycle trigged) to make that SingleTask Activity to appear on top of stack. [Here](https://inthecheesefactory.com/blog/understand-android-activity-launchmode/en) is a great article you can refer to understand the various launch modes. – Amruta Deshmukh Dec 14 '17 at 18:21
  • @san Also, please note for deep linking to work appropriately, we need the Activity to be defined as singleTask to avoid multiple instances of the app. – Amruta Deshmukh Dec 14 '17 at 18:22