2011-09-01 39 views
10

我想要在浏览器中访问某个HTML URL时尝试放置一个意图过滤器来启动我的应用程序。当它是标准网址时,我没有问题,例如www.stonyx.com。使用Android Intent过滤器匹配URL中的HTTP参数

但是,我需要匹配一个URL与HTTP参数,如www.stonyx.com/?pagename,它是后面的部分?我遇到了匹配问题。

我采用了android尝试:路径,机器人:pathPrefix,和android:pathPattern,和他们都不做,我...不知道,如果是因为我做错了什么,或者如果它只是因为它是一个带有问号的php路径。任何帮助,高度赞赏。

P.S.这是我目前的意图过滤器看起来像

<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> 

回答

11

你不能。 :(根据http://developer.android.com/guide/components/intents-filters.html

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

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

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

+3

只是想让你知道,如果你确实想得到参数,你总是可以从“data”元素中解析出来,它会给你整个URI。使用getIntent()。getData()来获取URI。 – PaulP