我想拦截几个不同的链接与我的应用程序,我有意图过滤器数据参数的麻烦做到这一点。Android意图过滤http地址
这里有2种类型的,我想拦截
我已经决定有一个单独的活动来拦截这两个链接和使用Java正则表达式链接开始正确的活动。不过,我似乎无法捕捉到只是这两种格式,无需捕捉像http://www.domain.com/abc123
<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型
<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>
感谢,
嘿@leo我想实现同样的事情,我只是想打开我的应用程序时,用户从浏览器启动移动网站我做了同样的事情在这里,但它没有任何帮助? – Tony 2016-05-23 01:20:55