<uses-feature>

syntax:
<uses-feature android:glEsVersion="integer"
              android:name="string"
              android:required=["true" | "false"] />
contained in:
<manifest>
description:
This element declares a specific feature used by the application. Android provides some features that may not be equally supported by all Android devices. In a manner similar to the <uses-sdk> element, this element allows an application to specify which device-variable features it uses. For example, an application might specify that it requires a camera with auto-focus capabilities.

Declaring a <uses-feature> element is informational only, meaning that the Android system itself does not check for matching feature support on the device before installing an application. However, note that other services (such as Android Market) or applications may check your application's <uses-feature> declarations as part of handling or interacting with your application. For this reason, it's very important that you declare all of the features (from the list below) that your application uses.

For some features, there may exist a specfic attribute that allows you to define a version of the feature, such as the version of Open GL used (declared with glEsVersion). Other features that either do or do not exist for a device, such as a camera, are declared using the name attribute.

Any software or hardware features that may vary among Android-powered devices will be listed on this page among the attributes below. If you see any features here that you use in your application, you should include a <uses-feature> element for each one. For example, if your application uses the device camera, then you should include the following in your AndroidManifest.xml:

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

If you declare android.hardware.camera this way, then your application is considered compatible with all devices that include a camera. If your application also uses auto-focus features, then you also need to include a <uses-feature> element that declares the android.hardware.camera.autofocus feature. Also note that you must still request the CAMERA permission. Requesting the permission grants your application access to the appropriate hardware and software, while declaring the features used by your application ensures proper device compatibility.

Although the <uses-feature> element is only activated for devices running API Level 4 or higher, it is safe to include this for applications that declare a minSdkVersion of "3" or lower. Devices running older versions of the platform will simply ignore this element, but newer devices will recognize it and enforce installation restrictions based on whether the device supports the feature.

Note: For each feature required by your application, you must include a new <uses-feature> element. Multiple features cannot be declared in one instance of this element.

attributes:
android:glEsVersion
The OpenGL ES version required by the application. The higher 16 bits represent the major number and the lower 16 bits represent the minor number. For example, to specify OpenGL ES version 2.0, you would set the value as "0x00020000". To specify OpenGL ES 2.1, if/when such a version were made available, you would set the value as "0x00020001".

An application should specify at most one android:glEsVersion attribute in its manifest. If it specifies more than one, the android:glEsVersion with the numerically highest value is used and any other values are ignored.

If an application does not specify an android:glEsVersion attribute, then it is assumed that the application requires only OpenGL ES 1.0, which is supported by all Android-powered devices.

An application can assume that if a platform supports a given OpenGL ES version, it also supports all numerically lower OpenGL ES versions. Therefore, an application that requires both OpenGL ES 1.0 and OpenGL ES 2.0 must specify that it requires OpenGL ES 2.0.

An application that can work with any of several OpenGL ES versions should only specify the numerically lowest version of OpenGL ES that it requires. (It can check at run-time whether a higher level of OpenGL ES is available.)

android:name
The name of a feature required by the application. The value must be one of the following accepted strings:
Feature Attribute Value Description
Camera android.hardware.camera The application requires a camera.
Note: Any application that requests the CAMERA permission but does not declare any camera features with the <uses-feature> element will be assumed to use all camera features (auto-focus and flash). Thus, the application will not be compatible with devices that do not support all camera features. Please use <uses-feature> to declare only the camera features that your application does need. For instance, if you request the CAMERA permission, but you do not need auto-focus or flash, then declare only the android.hardware.camera feature—the other camera features that you do not request will no longer be assumed as required.
Camera auto-focus android.hardware.camera.autofocus The application requires a camera with auto-focus capability. As a prerequisite, android.hardware.camera must also be declared with a separate <uses-feature> element.
Camera flash android.hardware.camera.flash The application requires a camera with a flash. As a prerequisite, both android.hardware.camera and android.hardware.camera.autofocus must also be declared with separate <uses-feature> elements.
Light sensor android.hardware.sensor.light The application requires a device with a light sensor.
Live Wallpaper android.software.live_wallpaper The application uses or provides Live Wallpapers and should be installed only on devices that support Live Wallpapers.
Proximity sensor android.hardware.sensor.proximity The application requires a device with a proximity sensor.
Multitouch screen android.hardware.touchscreen.multitouch The application requires a device that supports multitouch.
Telephony android.hardware.telephony The application requires a device that includes a telephony radio with data communication services.
CDMA telephony android.hardware.telephony.cdma The application requires a device that includes a CDMA telephony radio. As a prerequisite, android.hardware.telephony must also be declared with a separate <uses-feature> element.
GSM telephony android.hardware.telephony.gsm The application requires a device that includes a GSM telephony radio. As a prerequisite, android.hardware.telephony must also be declared with a separate <uses-feature> element.
android:required
Indicates whether the feature is required by the application. This is true by default. You should not use this attribute for most cases.

The only situation in which you should set this attribute false is when your application requests the CAMERA permission, but will degrade gracefully and perform without failure if the device does not have a camera. In this situation, you must declare the android.hardware.camera feature and set the required attribute false. This is necessary because the CAMERA permission will automatically turn on the requirement for all camera features. So if your application uses this permission but is still compatible with devices without a camera, then you must set the required attribute false for android.hardware.camera or else it will not install on devices without a camera. Note that, while the permission will enable the requirement for all camera features, you only need to off the requirement for the basic camera feature.

introduced in:
API Level 4
see also:
↑ Go to top