使用path,pathPrefix或pathPattern的意图过滤器 [英] Intent filter using path,pathPrefix, or pathPattern

查看:700
本文介绍了使用path,pathPrefix或pathPattern的意图过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的测试uri字符串是

My test uri string is

http://test.host.com/path/test.html?key1 = val1& key2 = val2

然后我在清单中创建了意图过滤器

And I make intent-filter in manifest

A.计划和主机(可以,但是我不想要)

A. scheme & host (It works but I do not want)

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <data
        android:scheme="http"
        android:host="test.host.com"
    />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

B. &路径(pathPrefix,pathPattern)(无效)

B. A & path(pathPrefix, pathPattern) (Not worked)

    <data
        android:scheme="http"
        android:host="test.host.com"

        1. android:path="path/test.html" -> not worked (link to chrome broswer)
        2. android:path="path"           -> not worked (link to chrome broswer)
        3. android:pathPrefix="path"     -> not worked (link to chrome broswer)
        4. android:pathPattern="user/invite.*"  -> same (I do not know pattern)

    />

我想仅在(path/test.html)

I want to start my app when only (path/test.html),

推荐答案

开始时您缺少斜线.以下应该可以工作:

You are missing the slash at the beginning. The following should work:

android:path="/path/test.html"

OR

android:pathPrefix="/path/test.html"

这篇关于使用path,pathPrefix或pathPattern的意图过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆