ChuckKelly
ChuckKelly

Reputation: 1740

Android deep linking doesn't launch app

I'm pulling my hair out over this; the instructions seemed so simple, yet they just don't work.

Here's the manifest activity intent code:

<activity
    android:theme="@style/Theme.Buhzyellowtoplighttabs"
    android:name="com.blah.package"
    android:configChanges="orientation|keyboardHidden"
    android:windowSoftInputMode="adjustResize|stateHidden" 
    android:screenOrientation="portrait" >

    <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="http" android:host="www.buhz.com" />
    </intent-filter>

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

So you would think that when I run the app on my phone, go to my browser and go to www.buhz.com it should give me a option to launch the app, right?

Upvotes: 3

Views: 8791

Answers (3)

Aetherna
Aetherna

Reputation: 261

For me:

adb shell  am start  -W -a android.intent.action.VIEW  -d "example://gizmos" com.example

didn't work. Adding category solved it:

adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://www.example.com/gizmos"

Upvotes: 2

sheikirfanbasha
sheikirfanbasha

Reputation: 33

Here is the approach that worked for me

The androidmanifest file content is as follows:

<activity
        android:name=".SecondActivity"
        android:label="@string/title_activity_second">
        <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:host="www.example.com"
                android:pathPrefix="/roses"
                android:scheme="http" />

        </intent-filter>
    </activity>

The command entered in terminal is as follows :

./adb shell am start -a android.intent.action.VIEW -d "http://www.example.com/roses" com.example.irfan.helloworld

Note: If your operating system is Windows you can remove the first "./" in the above command.

Result:

It opened the "Second Activity" of my app automatically.

Hope it helps :)

Upvotes: 1

user184994
user184994

Reputation: 18271

As far as I'm aware, this will only work when you click a link to the site, not when you type the URL in.

On the off-chance you're reading this on the Android device your testing on, here is a link for you

Upvotes: 4

Related Questions