1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
use ;
use crateVarOrBool;
/// Declares a single hardware or software feature that is used by the
/// application.
///
/// The purpose of a <uses-feature> 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
/// <uses-feature> 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:
///
/// ```xml
/// <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 <uses-feature> 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 <uses-feature> 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
/// ```xml
/// <uses-feature android:name="string"
/// android:required=["true" | "false"]
/// android:glEsVersion="integer" />
/// ```
///
/// ## Contained in
/// * [`<manifest>`]
///
/// ## Introduced in
/// API Level 4
///
/// [`PackageManager`]: https://developer.android.com/reference/android/content/pm/PackageManagers
/// [`Features Reference`]: https://developer.android.com/guide/topics/manifest/uses-feature-element#features-reference
/// [`glEsVersion`]: crate::UsesFeature#structfield.gl_es_version
/// [`name`]: crate::UsesFeature#structfield.name
/// [`CAMERA`]: https://developer.android.com/reference/android/Manifest.permission#CAMERA
/// [`minSdkVersion`]: crate::UsesSdk#structfield.min_sdk_version
/// [`Google Play and Feature-Based Filtering`]: https://developer.android.com/guide/topics/manifest/uses-feature-element#market-feature-filtering
/// [`<manifest>`]: crate::AndroidManifest