标签:complete car rail top sch auth invalid wildcards link
<data> | Android Developers https://developer.android.com/guide/topics/manifest/data-element.html
<data android:scheme="string"
android:host="string"
android:port="string"
android:path="string"
android:pathPattern="string"
android:pathPrefix="string"
android:mimeType="string" />
<intent-filter>
mimeType
attribute), just a URI, or both a data type and a URI. A URI is specified by separate attributes for each of its parts:
<scheme>://<host>:<port>[<path>|<pathPrefix>|<pathPattern>]
These attributes that specify the URL format are optional, but also mutually dependent:
scheme
is not specified for the intent filter, all the other URI attributes are ignored.host
is not specified for the filter, the port
attribute and all the path attributes are ignored.All the <data>
elements contained within the same <intent-filter>
element contribute to the same filter. So, for example, the following filter specification,
<intent-filter . . . >
<data android:scheme="something" android:host="project.example.com" />
. . .
</intent-filter>
is equivalent to this one:
<intent-filter . . . >
<data android:scheme="something" />
<data android:host="project.example.com" />
. . .
</intent-filter>
You can place any number of <data>
elements inside an <intent-filter>
to give it multiple data options. None of its attributes have default values.
Information on how intent filters work, including the rules for how Intent objects are matched against filters, can be found in another document,Intents and Intent Filters. See also the Intent Filters section in the manifest file overview.
android:scheme
scheme
attribute must be set for the filter, or none of the other URI attributes are meaningful.
A scheme is specified without the trailing colon (for example, http
, rather than http:
).
If the filter has a data type set (the mimeType
attribute) but no scheme, the content:
and file:
schemes are assumed.
Note: Scheme matching in the Android framework is case-sensitive, unlike the RFC. As a result, you should always specify schemes using lowercase letters.
android:host
scheme
attribute is also specified for the filter. To match multiple subdomains, use an asterisk (*
) to match zero or more characters in the host. For example, the host *.google.com
matcheswww.google.com
, .google.com
, and developer.google.com
.
The asterisk must be the first character of the host attribute. For example, the host google.co.*
is invalid because the asterisk wildcard is not the first character.
Note: host name matching in the Android framework is case-sensitive, unlike the formal RFC. As a result, you should always specify host names using lowercase letters.
android:port
scheme
and host
attributes are also specified for the filter.android:path
android:pathPrefix
android:pathPattern
path
attribute specifies a complete path that is matched against the complete path in an Intent object. The pathPrefix
attribute specifies a partial path that is matched against only the initial part of the path in the Intent object. The pathPattern
attribute specifies a complete path that is matched against the complete path in the Intent object, but it can contain the following wildcards:
*
‘) matches a sequence of 0 to many occurrences of the immediately preceding character..*
") matches any sequence of 0 to many characters.Because ‘\
‘ is used as an escape character when the string is read from XML (before it is parsed as a pattern), you will need to double-escape: For example, a literal ‘*
‘ would be written as "\\*
" and a literal ‘\
‘ would be written as "\\\\
". This is basically the same as what you would need to write if constructing the string in Java code.
For more information on these three types of patterns, see the descriptions of PATTERN_LITERAL
, PATTERN_PREFIX
, andPATTERN_SIMPLE_GLOB
in the PatternMatcher
class.
These attributes are meaningful only if the scheme
and host
attributes are also specified for the filter.
android:mimeType
image/jpeg
or audio/mpeg4-generic
. The subtype can be the asterisk wildcard (*
) to indicate that any subtype matches.
It‘s common for an intent filter to declare a <data>
that includes only the android:mimeType
attribute.
Note: MIME type matching in the Android framework is case-sensitive, unlike formal RFC MIME types. As a result, you should always specify MIME types using lowercase letters.
<action>
<category>
w
体会“协议”
http://stackoverflow.com/questions/3469908/make-a-link-in-the-android-browser-start-up-my-app
http://stackoverflow.com/questions/2958701/launch-custom-android-application-from-android-browser
更新:通过浏览器直接打开Android应用程序 - Cundong‘s log https://my.oschina.net/liucundong/blog/354029
Android实现通过浏览器点击链接打开本地应用(APP)并拿到浏览器传递的数据 - 被艺术搞,哥很享受! - 博客频道 - CSDN.NET http://blog.csdn.net/jiangwei0910410003/article/details/23940445
<a href="[scheme]://[host]/[path]?[query]">启动应用程序</a>
各个项目含义如下所示:
scheme:判别启动的App。 ※详细后述
host:适当记述
path:传值时必须的key ※没有也可以
query:获取值的Key和Value ※没有也可以
标签:complete car rail top sch auth invalid wildcards link
原文地址:http://www.cnblogs.com/yuanjiangw/p/6713350.html