#StackBounty: #android #firebase-dynamic-links #android-architecture-navigation #android-deep-link Fragment automatically jumps to star…

Bounty: 50

I’m using Firebase Dynamic links to share a particular product with another user. I’m able to create the product share link. The link is generating fine. I’m detecting the link in my main login activity which is the launcher activity of the app.
The link is also getting detected fine. I have 2 navigation graphs. One for the login process and one for the main app. I’ve to open a particular fragment in the main graph from the login graph. I’m detecting the link in the login graph and creating a deep link as follows:

navController.createDeepLink()
.setComponentName(MainActivity::class.java)
.setGraph(R.navigation.nav_graph_main)
.setDestination(R.id.storeFragment)
.setArguments(bundle)
.createPendingIntent()
.send()

The problem is that when I open the storeFragment, the app jumps to the home fragment of the nav_graph_main. It doesn’t stay at the newFragment. Only for a moment.

My nav_graph_main is below :

<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/nav_graph_main"
    app:startDestination="@id/homeFragment">

...other fragments

 <fragment
        android:id="@+id/storeFragment"
        android:name="in.indiahaat.feature.main.home.store_screen.StoreFragment"
        android:label="fragment_store"
        tools:layout="@layout/fragment_store" >
        <action
            android:id="@+id/action_storeFragment_pop"
            app:popUpTo="@id/storeFragment"
            app:popUpToInclusive="true" />

        <action
            android:id="@+id/storeFragment_to_reportRetailerFragment"
            app:popUpTo="@id/reportRetailerFragment"
            app:destination="@id/reportRetailerFragment" />
    </fragment>

...other fragments

</navigation>

Please post a solution for this as I’ve been stuck on it for a while now.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.