Android Navigation Deep Link Nested Navigation automatic backstack

Viewed 307

I have been looking into essentially deep linking/navigation directly into any page within an application. There are many use cases for this but one for example is a registration process where I want users to be able to skip to certain pages but still allow the backstack to work. To give an explicit example MainFragment -> RegistrationFragment1 -> RegistrationFragment2 -> RegistrationFragment3 ->RegistrationFragment4 -> RegistrationFragment5 I want to be able to open directly to any of those pages and have the backstack work just like the above. I have an example repo here with an example of that https://github.com/DavidCorrado/AndroidNavigation

So from my understanding there are a few ways I can manage that. I would like to do something with navigation with nested navigation graphs that provide this via xml and nesting navigation. Basically like this article https://medium.com/swlh/proper-back-stack-on-android-every-time-4a811f8ab78c

Problem I have is the above article works with creating a pending intent via a notification and that does work but I do not think I should be using pending intents everywhere for any navigation.

I want to just deep link via uri or via some other way with graph and destination. I would imagine there is just something I am missing.

Below is a MainFragment where I link to all of the different things I tried https://github.com/DavidCorrado/AndroidNavigation/blob/master/app/src/main/java/com/example/navigation/ui/main/MainFragment.kt

btn_reg5 is the pending intent which does provide proper backstack but I imagine I should find a way to do this without a pending intent.

All other buttons do not work.

0 Answers
Related