pub struct UsesFeature {
    pub name: Option<String>,
    pub required: Option<VarOrBool>,
    pub gl_es_version: Option<String>,
}
Expand description

Declares a single hardware or software feature that is used by the application.

The purpose of a declaration is to inform any external entity of the set of hardware and software features on which your application depends. The element offers a required attribute that lets you specify whether your application requires and cannot function without the declared feature, or whether it prefers to have the feature but can function without it. Because feature support can vary across Android devices, the element serves an important role in letting an application describe the device-variable features that it uses. The set of available features that your application declares corresponds to the set of feature constants made available by the Android PackageManager, which are listed for convenience in the Features Reference sections at the bottom of this document. You must specify each feature in a separate <uses-feature> element, so if your application requires multiple features, it would declare multiple <uses-feature> elements. For example, an application that requires both

Bluetooth and camera features in the device would declare these two elements:

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

In general, you should always make sure to declare <uses-feature> elements for all of the features that your application requires. Declared <uses-feature> elements are informational only, meaning that the Android system itself does not check for matching feature support on the device before installing an application. However, other services (such as Google Play) 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 specific 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. Although the element is only activated for devices running API Level 4 or higher, it is recommended to include these elements for all applications, even if the minSdkVersion is “3” or lower. Devices running older versions of the platform will simply ignore the element.

Note

When declaring a feature, remember that you must also request permissions as appropriate. For example, you must still request the CAMERA permission before your application can access the camera API. 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.

Important

Google Play uses the elements declared in your app manifest to filter your app from devices that do not meet its hardware and software feature requirements.

By specifying the features that your application requires, you enable Google Play to present your application only to users whose devices meet the application’s feature requirements, rather than presenting it to all users.s

For important information about how Google Play uses features as the basis for filtering, please read Google Play and Feature-Based Filtering, below.

XML Syntax

<uses-feature android:name="string"
              android:required=["true" | "false"]
              android:glEsVersion="integer" />

Contained in

Introduced in

API Level 4

Fields§

§name: Option<String>

Specifies a single hardware or software feature used by the application, as a descriptor string. Valid attribute values are listed in the Hardware features and Software features sections. These attribute values are case-sensitive.

§required: Option<VarOrBool>

Boolean value that indicates whether the application requires the feature specified in android:name.

  • When you declare android:required="true" for a feature, you are specifying that the application cannot function, or is not designed to function, when the specified feature is not present on the device.
  • When you declare android:required="false" for a feature, it means that the application prefers to use the feature if present on the device, but that it is designed to function without the specified feature, if necessary.

The default value for android:required if not declared is "true".

§gl_es_version: Option<String>

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”, or to specify OpenGL ES 3.2, you would set the value as “0x00030002”. 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.

For more information about using OpenGL ES, including how to check the supported OpenGL ES version at runtime, see the OpenGL ES API guide.

Trait Implementations§

source§

impl Clone for UsesFeature

source§

fn clone(&self) -> UsesFeature

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UsesFeature

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for UsesFeature

source§

fn default() -> UsesFeature

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for UsesFeature

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<UsesFeature> for UsesFeature

source§

fn eq(&self, other: &UsesFeature) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for UsesFeature

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl YaDeserialize for UsesFeature

source§

fn deserialize<R: Read>(reader: &mut Deserializer<R>) -> Result<Self, String>

source§

impl YaSerialize for UsesFeature

source§

fn serialize<W: Write>(&self, writer: &mut Serializer<W>) -> Result<(), String>

source§

fn serialize_attributes( &self, source_attributes: Vec<OwnedAttribute>, source_namespace: Namespace ) -> Result<(Vec<OwnedAttribute>, Namespace), String>

source§

impl Eq for UsesFeature

source§

impl StructuralEq for UsesFeature

source§

impl StructuralPartialEq for UsesFeature

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,