在URL匹配HTTP参数与Android意图过滤器过滤器、意图、参数、URL

2023-09-08 08:31:35 作者:卿珞.

我试图把一个意图过滤器来启动我的应用程序时,某些HTML网址在浏览器中访问。我没有问题,这样做时,它是一个标准的URL,就像www.stonyx.com为例。

不过,我需要匹配与像www.stonyx.com/?pagename HTTP参数的URL,它的后部分?说我有麻烦匹配。

路径,机器人:路径preFIX,和android:pathPattern,和他们都不这样做,我......不知道这是否是因为我做错了什么或

我采用了android尝试如果它只是因为它是一个PHP的路径与问号。任何帮助是非常AP preciated。

P.S。下面是我的意图过滤器看起来像此刻

 <意向滤光器>
  <作用机器人:名称=android.intent.action.VIEW>< /作用>
  <类机器人:名称=android.intent.category.DEFAULT>< /类>
  <类机器人:名称=android.intent.category.BROWSABLE>< /类>
  <数据机器人:主机=www.megaupload.com机器人:计划=HTTP>< /数据>
&所述; /意图滤光器>
 

解决方案

您不能。 :(

根据http://developer.android.com/guide/components/intents-filters.html

  android中用意图打开音乐播放器并播放指定路径的音乐

每个元素可以指定URI和一个数据类型(MIME媒体类型)。有单独的属性 - 模式,主机,端口和路径 - 为URI的各个部分:

     

方案://主机:端口/路径

没有参数或查询字符串。 (因此,?标记之后的部分被简单地不匹配任何东西)

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>

解决方案

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)