How to filter only specific URL with intent filter

Hurda picture Hurda · Mar 18, 2012 · Viewed 10.2k times · Source

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>

Answer

Jeffrey Blattman picture Jeffrey Blattman · Mar 18, 2012

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.