I'm using Android Navigation UI for navigation in my app. I need to open a web URL (dynamic links) in my second fragment.
this is my code in the navigation graph
<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/mobile_navigation"
app:startDestination="@+id/nav_home">
<fragment
android:id="@+id/nav_home"
android:name="com.myproject.main.HomeFragment"
android:label="Home"
tools:layout="@layout/fragment_home" >
<action
android:id="@+id/action_nav_home_to_secondFragment"
app:destination="@id/secondFragment" />
</fragment>
<fragment
android:id="@+id/nav_library"
android:name="com.myproject.main.SecondFragment"
android:label="@string/menu_library"
tools:layout="@layout/fragment_library">
<deepLink
android:id="@+id/deepLink"
app:uri="https://myproject.page.link/*" />
</fragment>
</navigation>
And added this navigation graph to my main activity in the manifest
<activity
android:name=".main.MainActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
>
<nav-graph android:value="@navigation/mobile_navigation" />
</activity>
I want to open my second fragment when the user clicks on a URL like https://myproject.page.link/i5sA but when I click on this link my app is even not prompted to open in this app. Only browsers are prompted. when I click on open with chrome browser it just opens my app with the default start destination.
what I need is when user press on that web URL I need to open my app MainActivity with SecondFragment and get that URL data instead of opening the default home fragment.
I had seen the developer page and a lot of articles and tutorials but I don't know what I'm missing here, anyone can please tell me...