When I type the command in adb:
./adb shell am start -W -a android.intent.action.VIEW -d "example:gizmos" com.myapp
I get this error:
Starting: Intent { act=android.intent.action.VIEW dat=example://gizmos pkg=com.myapp }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=example://gizmos flg=0x10000000 pkg=com.myapp }
But when I type the command in adb:
./adb shell am start -W -a android.intent.action.VIEW -d "example:gizmos" com.myapp.activity.DeepLinkActivity
Everything works fine and I get the message and I can see the activity launch on the phone:
Starting: Intent { act=android.intent.action.VIEW dat=example://gizmos cmp=com.myapp.activity.DeepLinkActivity }
Status: timeout
Activity: com.myapp.activity.DrawerActivity
Complete
My question is why do I need to get full path of my activity and not just package name? Because when the external apps or browser will try to deep link they will not invoke the activity in my app.
This is my AndroidManifest.xml
<activity
android:name=".activity.DeepLinkActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="example"
android:host="gizmos" />
</intent-filter>
</activity>
Terminal
of Android Studio it can write:/system/bin/sh: com.myapp: inaccessible or not found
. The app link starts without error. To avoid this message, just removecom.myapp
from the end. – Deckle