'Deep link navigating to parent activity does not work with navigation architecture component explicit deep link

I have a profile activity and MainActivity which is the parent of Profile Activity. I have a common activity with no ui to handle deep links re-direction using explicit deep links

Manifest file

 <activity
        android:name=".ui.profile.ProfileActivity"
        android:screenOrientation="portrait"
        android:parentActivityName="com.peoplemesh.now.ui.MainActivity" >

    <!-- Parent activity meta-data to support 4.0 and lower -->
    <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value=".ui.MainActivity" />
</activity>

Deep link activity code

val pendingIntent = NavDeepLinkBuilder(this)
    .setGraph(R.navigation.profile_nav)
    .setDestination(R.id.profileFrag)
    .setArguments(bundle)
    .setComponentName(ProfileActivity::class.java)
    .createPendingIntent()

pendingIntent.send(0)

Profile screen

navController.setGraph(R.navigation.profile_nav, bundle)

val appBarConfiguration = AppBarConfiguration(
    topLevelDestinationIds = setOf(),
    fallbackOnNavigateUpListener = ::onSupportNavigateUp
)

mBinding.toolbar.setupWithNavController(navController, appBarConfiguration)

Deep link to ProfileActivity -> up navigate -> closes app ( since there is not activity in stack).

How do i fix this?.

Update:

Not sure if this is of any help or a similar issue reported https://issuetracker.google.com/issues/142379671?pli=1



Sources

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

Source: Stack Overflow

Solution Source