2

I have a activity that apply intent filter to open deeplink, this is my intent filter :

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

                <action android:name="android.intent.action.VIEW" />

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

                <data
                    android:host="www.example.com"
                    android:pathPattern="/..*"
                    android:scheme="https" />
</intent-filter>

my problem is, when user open a link i.e "www.example.com/somepage" from messaging apps e.g Hangout,Whatsapp, Android app chooser doesn't display may apps in its list, it just show all browser app in the options. But when user put "https://www.example.com/somepage" in a message then it works, Android show my app in its App chooser to open the link. It also doesn't work When I try to remove android:scheme="https" from my intent filter.

is there anyone has same problem and have a solution?

Any help really appreciated.

ZeeDroid
  • 145
  • 1
  • 11

1 Answers1

0

This is expected behavior.

What the following snippet does is register your app as a handler for the URL scheme https://

<data
    android:host="www.example.com"
    android:pathPattern="/..*"
    android:scheme="https" />

This means your app will be offered as an option for any link beginning with https:// and containing www.example.com. The string www.example.com/somepage doesn't qualify, as it is missing the https:// part.

You could try adding a second filter for http:// links. I'm not sure if Android automatically infers that as the scheme for web links without a scheme specified, so it's possible this could resolve the issue.

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

  <action android:name="android.intent.action.VIEW" />

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

  <data
      android:host="www.example.com"
      android:pathPattern="/..*"
      android:scheme="https" />

  <data
      android:host="www.example.com"
      android:pathPattern="/..*"
      android:scheme="http" />
</intent-filter>
Alex Bauer
  • 13,147
  • 1
  • 27
  • 44