I'm developing an app and using navigation component to navigate between screens.
I have this problem when I open my app using a deep link and want to popup to my home screen when the user pressed back button.
The graph is like this:
<navigation startDestination="@id/starter" >
<fragment id="@+id/starter" />
<fragment id="@+id/home" />
<fragment id="@+id/profile" >
<deepLink uri="app://profile" />
</fragment>
</navigation>
And this is the scenario:
Click on link https//domain.com/app/profile -> app opens -> starter fragment receives the intent data -> navigate to profile -> the back button pressed -> app closes // here I want to navigate back to my home screen.
I also set popUpTo parameter, but it doesn't work:
navController.navigate(
uri,
NavOptions.Builder()
.setPopUpTo(R.id.home, false).build()
)