I have a single activity app, with three fragments, A, B, C. In the normal app flow, fragments are opened in sequence: A->B->C I have a foreground service with a notification that when clicked, should open fragment C. I use Navigation Architecture Component, and add the destination to the notification as a deeplink:
NotificationCompat.Builder(context, NOTIFICATION_CHANNEL)
....
.setContentIntent(NavDeepLinkBuilder(context)
.setGraph(R.navigation.main_navigation)
.setDestination(R.id.fragmentC)
.setArguments(bundle)
.createPendingIntent())
.build()
The fragment backstack is not built. When I navigate back from fragment C, I immediately get to fragment A, not to B. According to Principles of navigation the backstack shall be natural, but I cannot seem to be able to achieve that. What am I missing here? Thank you.