Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am trying to test android deep link urls through adb to launch my app

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> 
like image 624
user3773337 Avatar asked Mar 02 '15 03:03

user3773337


People also ask

How do I check my deep link app?

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.

How do I enable deep link on Android?

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.

What is deep linking in Android example?

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.


1 Answers

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

like image 136
pixel Avatar answered Sep 19 '22 13:09

pixel