Henrique
Henrique

Reputation: 5011

Have an Android app react to deep link

I'm trying to make my android app react to a specific deep link format. I want the app to be able to handle links in the following format:

href="android-app://website.org/http/a_path"

I have the following in my manifest file:

    <intent-filter android:label="App" >
        <action android:name="android.intent.action.VIEW" />
        <data
            android:host="website.org"
            android:scheme="http" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
    </intent-filter>

When I test it from the console, the app reacts to the following deeplink:

adb shell am start -a android.intent.action.VIEW -d "http://website.org/http/a_path" website.org

But it does not react to the format that I need, which is:

adb shell am start -a android.intent.action.VIEW -d "android-app://website.org/http/a_path" website.org

In this second case, I get the following error:

Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=http://org.website/http/a_path flg=0x10000000 pkg=website.org }

Any help is appreciated. Thanks!

Upvotes: 1

Views: 2621

Answers (2)

Marcin Orlowski
Marcin Orlowski

Reputation: 75609

I do not see you having filter for android-app scheme:

  <intent-filter>
      <action android:name="android.intent.action.VIEW"></action>
      <category android:name="android.intent.category.DEFAULT"></category>
      <category android:name="android.intent.category.BROWSABLE"></category>
      <data
           android:host="website.org"
           android:scheme="android-app" />
  </intent-filter>

But anyway, do not use custom schemes. See this discussion involving android framework developer: https://groups.google.com/forum/#!topic/android-developers/-hkq8-S5-Gs

Upvotes: 0

r2DoesInc
r2DoesInc

Reputation: 3771

You need to correctly set your scheme.

            <intent-filter>
                <action android:name="android.intent.action.VIEW"></action>
                <category android:name="android.intent.category.DEFAULT"></category>
                <category android:name="android.intent.category.BROWSABLE"></category>
                <data android:scheme="android-app"></data>
            </intent-filter>

Upvotes: 4

Related Questions