Match HTTP parameters in URL with Android Intent F

2020-03-12 04:20发布

问题:

I'm trying to put together an intent filter to start my application when a certain HTML URL is accessed in the browser. I have no problems doing so when it's a standard url, like www.stonyx.com for example.

However, I need to match an URL with HTTP parameters like www.stonyx.com/?pagename and it's the part after the ? that I'm having trouble matching.

I've tried using android:path, android:pathPrefix, and android:pathPattern, and none of them seem to do it for me ... not sure if it's cause I'm doing something wrong or if it's just because it's a php path with a question mark. Any help is highly appreciated.

P.S. Here's what my intent filter looks like at the moment

<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="www.megaupload.com" android:scheme="http"></data>
</intent-filter>

回答1:

You can't. :(

according to http://developer.android.com/guide/components/intents-filters.html :

Each element can specify a URI and a data type (MIME media type). There are separate attributes — scheme, host, port, and path — for each part of the URI:

scheme://host:port/path

no parameters or query strings. (thus, the part after the ? mark is simply not matched against anything)