Issue
Can't open the deeplink URL. Here is the code I used
<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/app_navigation"
app:startDestination="@id/loginActivity">
<activity
android:id="@+id/passwordCreateActivity"
android:name=".PasswordCreateActivity"
android:label="password_create_activity"
tools:layout="@layout/password_create_activity">
<deepLink
app:uri="www.example.com/auth/activate/{token}" />
</activity>
</navigation>
I have used the intent to open the deeplink
adb shell am start -a android.intent.action.VIEW -d "www.example.com/auth/activate/2i8haFs4NqxFdzRUYoYJbq1C0?check-scheme=1" com.example.app
dependency
implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha02'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha02'
Solution
I have forgotten to register nav_graph
in AndroidManifest file.
Here is the full code for the Deep Link.
nav_graph.xml
<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/app_navigation"
app:startDestination="@id/loginActivity">
<activity
android:id="@+id/passwordCreateActivity"
android:name=".PasswordCreateActivity"
android:label="password_create_activity"
tools:layout="@layout/password_create_activity">
<deepLink app:uri="www.example.com/auth/activate/{token}" />
</activity>
</navigation>
AndroidManifest.xml
<activity android:name=".PasswordCreateActivity">
<nav-graph android:value="@navigation/app_nav" />
</activity>
Answered By - Rajesh Khadka
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.