'Deeplinking with Navigation component with Individual Stack

I have two urls which falls under the same deep link like below :

xxx.yyy.zzz/pages

xxx.yyy.zzz/how-deeplinks-work-exactly

Now the first one is a list of pages which goes to a fragment which lists the list of pages and second goes to a fragment which shows the details of that page.

Scenario :

https://github.com/android/architecture-components-samples/tree/master/NavigationAdvancedSample

I am following the above sample for having independent stacks for each tab. When I have two different deep links for the above two links, it navigates to both the fragments. Like when I open the app with xxx.yyy.zzz/pages url it opens both the PagesFragment and DetailFragment one after another. So when I press back button from PagesFragment it navigates back to DetailFragment.

Now how do I handle these two scenario with deep links. If have both the deep links setup it navigates to both the screens one by one. I know I can change the path and add a prefix the page detail url(xxx.yyy.zzz/page/how-deeplinks-work-exactly), but is there anyway I can intercept the parsing logic or add some exclude condition to achieve this without changing the url scheme?

Edit : This is likely an issue with the Navigation logic (NavigationExtensions.kt) written for having individual stack.



Solution 1:[1]

You shouldn't use NavigationExtensions.kt anymore, instead increase your navigation component library version. Check this article out: https://medium.com/androiddevelopers/navigation-multiple-back-stacks-6c67ba41952f

Perhaps upgrading the lib version also changes the behaviour of your app with respect to the deep links

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tommy 90