AndroidManifest. xml file description (uses-feature)

Source: Internet
Author: User

SYNTAX (SYNTAX ):

<Uses-featureandroid: name = "string"
Android: required = ["true" | "false"]
Android: glEsVersion = "integer"/>

Included IN (contained in ):

<Manifest>

DESCRIPTION ):

This element is used to declare a separate hardware or software feature used by the application.

<Uses-feature> the purpose of the Declaration is to notify other external entities of the hardware and software functions that the application depends on. The required attribute provided by this element allows you to specify whether the application can run normally when the required function does not exist. Because features support different Android devices, the <uses-feature> element is used to describe the important and available device features that the application depends on.

A set of available functions declared by the application correspond to a set of available function constants defined by the PackageManager class of Android. For convenience, these constants are listed in the "function reference" table of "Google Play and function-based filtering.

If an application requires multiple features, you must use the <uses-feature> element to specify each of the required features. For example, you need an application with Bluetooth and camera features on the device, to declare two <uses-feature> elements:

<Uses-feature android: name = "android. hardware. bluetooth"/>
<Uses-feature android: name = "android. hardware. camera"/>

Make sure that the <uses-feature> element is used to declare all functions required by the application.

The declared <uses-feature> element is only informational, which means that the Android system does not check the matching of features supported on the device before installing the application. However, other services (such as Google Play) or applications can check the <uses-feature> Declaration of the application and use it as part of interaction with the application. For this reason, it is essential to declare all external functions to be used by the application.

For some functions, a specific attribute may exist to define the version of the function, such as the version of Open GL used (declared by glEsVersion ). In some functions, you do not need to specify the version attribute, such as the camera. You only need to use the name attribute for declaration.

Although the <uses-feature> element is valid only when API Level 4 or a later version is run, we recommend that you include this element in all applications, even if the value of minSdkVersion is 3 or lower, devices running the old platform version will simply ignore this element.

Note: When declaring a function, remember to apply for the corresponding permissions. For example, you must apply for the Camera permission before the application can access the camera api. The permission application allows the application to access the corresponding software/hardware, and declares that the function used by the application is to ensure correct device compatibility.

ATTRIBUTES (ATTRIBUTES ):

Android: name

This attribute uses a descriptive string to specify the software/hardware features used by the application. Valid descriptors are listed in the "hardware functions" and "software functions" table of "Google Play and function-based filtering.

Android: required

This attribute uses a Boolean value to specify whether the application needs the features specified in the android: name attribute.

True: if the specified function does not exist on the device, the application cannot run normally.

False: If a specified function exists on the device, the application tends to use this function. However, if necessary, you can design a function that is not specified to run properly.

If not declared, the default value of this attribute is true.

Android: qlEsVersion

This attribute is used to declare the version of OpenGL ES required by the application. Its 16-bit high represents the main version number, and 16-bit low represents the minor version number. For example, if the version number of OpenGL ES is 2.0, it must be set to 0x00020000. The version number of OpenGL ES to be specified is 2.1. It must be set to 0x00020001.

An application can only specify one android: glEsVersion attribute in its list. If multiple attributes are specified, only the android: glEsVersion attribute with the highest version is used, others will be ignored.

If the application does not specify an android: glEsVersion attribute, it is assumed that the application only needs OpenGL ES1.0, which is supported on all Android devices.

The application can assume that if a platform supports the preset OpenGL ES version, it also supports all the OpenGL ES versions with lower versions. Therefore, applications that require OpenGL ES1.0 and OpenGL ES2.0 must specify the required version of OpenGL ES2.0.

Applications that can work with any version of OpenGL ES should only specify the minimum version of OpenGL ES required by the application. (The application can check whether a higher version of OpenGL ES is available at runtime .)

INTRODUCED version (introduced in ):

API Level 4

 

 

From FireOfStar's column

Related Article

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.