首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Android Intent-过滤http地址

Android Intent-过滤http地址
EN

Stack Overflow用户
提问于 2011-05-31 02:50:16
回答 1查看 10.2K关注 0票数 19

我正在尝试用我的应用程序截取几个不同的链接,但我在使用意图过滤器数据参数时遇到了问题。

下面是我想截取的两种类型的链接

  1. http://www.domain.com/#id=abcdef123346
  2. http://www.domain.com/social/landing/abcdef123456

我已经决定使用一个单独的活动来拦截这两个链接,并使用java regex来启动正确的活动。但是,如果不捕获http://www.domain.com/abc123之类的内容,我似乎无法仅捕获这两种格式

代码语言:javascript
复制
<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:scheme="http"
                android:host="www.domain.com"
                android:pathPattern="/#id.*" />
        </intent-filter>

这就是我目前正在尝试拦截的类型1,但由于某些原因,它不起作用。

此意图过滤器可正确拦截类型2

代码语言:javascript
复制
<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:scheme="http" />
            <data android:host="domain.com" />
            <data android:host="www.domain.com" />
            <data android:pathPrefix="/share/web" />
            <data android:pathPrefix="/social/landing" />
        </intent-filter>

谢谢,

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6179776

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档