Hurda
Hurda

Reputation: 4715

How to filter only specific URL with intent filter

I want to filter specific URL : http://gaapa.cz/mobile/*

But this filter is fired on every URl - ehta's wrong with that?

<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="gaapa.cz"
                android:path="/mobile/.*"
                android:scheme="http" />
</intent-filter>

Upvotes: 11

Views: 11430

Answers (3)

Jeffrey Blattman
Jeffrey Blattman

Reputation: 22647

You want to either use path, pathPrefix, or pathPattern, according to the docs here.

In your case, either pathPattern or pathPrefix will work,

pathPattern="mobile/*"

or

pathPrefix="mobile"

However, that does not explain why your filter is matching all URIs. it should be matching none since path does not understand "*". i suspect there is something added / missing from somewhere else in your code.

Upvotes: 13

Dheeraj Vepakomma
Dheeraj Vepakomma

Reputation: 28767

Try this:

<data android:host="gaapa.cz"
      android:pathprefix="mobile/"
      android:scheme="http" />

Upvotes: 3

ACC
ACC

Reputation: 2570

This should work:

<data android:host="gaapa.cz"
      android:path="mobile"
      android:pathPattern="*"
      android:scheme="http" />

Upvotes: 2

Related Questions