Androidmanifest. xml file (data)

Source: Internet
Author: User
Tags rfc

Syntax (syntax ):

<Dataandroid: host ="String"
Android: mimetype ="String"
Android: Path ="String"
Android: pathpattern ="String"
Android: pathprefix ="String"
Android: Port ="String"
Android: Scheme ="String"/>

Contained in (contained in ):

<Intent-filter>

Description ):

This element is used to add a data specification to an intent filter. The data specification can only be a data type (mimetype attribute) or a data location identifier (URI ), it can also be a data type and a data location identifier (URI ). A uri (in the following format) is divided into several independent attributes to be specified separately:

Scheme: // host: Port/path
OrPathprefix
OrPathpattern

 

These attributes are optional but also dependent on each other. If the scheme attribute is not specified for the intent filter, all other URI attributes will be ignored. If the host attribute is not specified for the filter, the port attribute and all path attributes are ignored.

All <DATA> elements contained in the same <intent-filter> element only apply to this filter. For example:

<Intent-filter...
>
<Data
Android: Scheme = "something"
Android: host = "project.example.com"
/>
...
</Intent-filter>

Equivalent

<Intent-filter...
>
<Data
Android: Scheme = "something"
/>
<Data
Android: host = "project.example.com"
/>
...
</Intent-filter>

You can place multiple <DATA> elements in the <intent-filter> element to set multiple data options for the filter. <DATA> the attribute of an element has no default value.

 

Attributes (attributes ):

Android: Host

This attribute defines the host part authorized by the URI. Unless the scheme attribute of the <DATA> element is specified for the filter, this attribute is meaningless.

Note: In the android framework, host name matching is case sensitive, which is different from RFC format. Therefore, you must always use lowercase letters to specify the host name.

Android: mimetype

This property is used to set the MIME type of the data, such as image/JPEG or audio/mpeg4-generic. The sub-type can be replaced by an asterisk (*) wildcard to indicate that it can match any sub-type.

Note: In the android framework, mime-type matching is case sensitive, which is different from RFC format. Therefore, you must always use lowercase letters to specify the MIME type.

Android: Path

Android: pathprefix

Android: pathpattern

The three attributes are used to specify the URL of the URI. The path attribute specifies a complete path, which matches the path in the intent object. The pathprefix attribute specifies only part of the path, which matches the initial part of the path in the intent object. The pathpattern attribute specifies a complete path to match the path in the intent object, but this path can contain the following wildcards:

1. asterisk (*) is a wildcard. * Asterisk in the path represents the character before any number of asterisks, such as a *, which can be a, AA, AAA, AAAA ,... string matching.

2.
A wildcard character (. *) that can be used to match any string, such as. * html. It can be used to match with abchhtml?chtml=html=dssf.html ,... .

Because the system uses the '\' symbol as a mandatory escape character when reading a string in XML, it needs to be escaped twice. For example, the "*" symbol must be written as "\ *", and the '\' symbol must be written "\\\\". This is basically the same as writing in Java code.

For more information about the three modes, see the descriptions of pattern_literal, pattern_prefix, and pattern_simple_glob in the patternmatcher class.

Http://developer.android.com/reference/android/ OS /PatternMatcher.html

Android: Port

This attribute is used to define the port section of the URI authorization. This attribute makes sense only when the scheme and host attributes are specified for the filter.

Android: Scheme

This attribute is used to set the scheme part of the URI. It is the most basic attribute set for a specified URI. At least a scheme attribute must be set for the filter. Otherwise, other URI attributes are meaningless.

The scheme property value does not end with the ":" symbol (for example, HTTP, rather than http :)

If the filter has a data type (the mimetype attribute is set) but the scheme attribute is not set, the system assumes that the scheme is content: and file:

Note: In the android framework, scheme is highly sensitive to lower case, which is different from RFC format. Therefore, you must always use lower-case letters to specify scheme.

Introduced (introduced in ):

API Level 1

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.