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>
Test your deep links You can use the Android Debug Bridge with the activity manager (am) tool to test that the intent filter URIs you specified for deep linking resolve to the correct app activity. You can run the adb command against a device or an emulator.
Android Studio makes it very easy to test deep links. Click Run > Edit Configurations to edit the configuration of the project. Open the General tab at the top and enter the URI in the Deep Link field in the Launch Options section.
A Deep Link is a URL link that is generated, when anyone clicks on that link our app will be open with a specific activity or a screen. Using this URL we can send a message to our app with parameters.
You don't need to specify full path to your activity, but if you want to test whether you react properly to URI in your app just specify app package:
adb shell am start -a android.intent.action.VIEW -d "example://gizmos" com.myapp
Also there is bug in command you provided - there should be example://gizmos
not example:gizmos
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With