Cha*_*gUZ 12 android uri intentfilter android-intent
我的测试uri字符串是
http://test.host.com/path/test.html?key1=val1&key2=val2
我在清单中制作了意图过滤器
A.计划和主持人(它有效,但我不想)
<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>
Run Code Online (Sandbox Code Playgroud)
B. A&path(pathPrefix,pathPattern)(不起作用)
<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)
/>
Run Code Online (Sandbox Code Playgroud)
我想开始我的应用程序时只(路径/ test.html中)
Dav*_*ser 15
你在开头就错过了斜线.以下应该有效:
android:path="/path/test.html"
Run Code Online (Sandbox Code Playgroud)
要么
android:pathPrefix="/path/test.html"
Run Code Online (Sandbox Code Playgroud)
如果您只需要启动应用程序如果仅用于链接/path/test.html那么仅android:path在data标记中使用属性
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http"
android:host="test.host.com"
android:path="/path/test.html" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
As android:path属性指定与Intent对象中的完整路径匹配的完整路径.
但是, android:pathPrefix attribute指定仅与Intent对象中路径的初始部分匹配的部分路径.
所以,当使用android:pathPrefix属性没有android:path属性,它意味着你的应用程序可以启动/path/test.html,/path/test.html?key1=value1,/path/test.html?key1=value1&key2=value2,等
有关更多信息Android的文档数据标记成intent-filter
| 归档时间: |
|
| 查看次数: |
17304 次 |
| 最近记录: |