3

Does the usage of parent feature (for uses-feature tag) in AndroidManifest.xml mean the same as all enabled child features?

For example, is the following block

<uses-feature android:name="android.hardware.location" android:required="false" />

equal to

<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
4

1 回答 1

3

Does the usage of parent feature (for uses-feature tag) in AndroidManifest.xml mean the same as all enabled child features?

It does not. The 2 blocks you show are not equal. The opposite is true however: if you declare android.hardware.location.gps, it is automatically implied that you also declare android.hardware.location

See the documentation for more info. I copied relevant parts and emphasized in bold:

android.hardware.location
The app uses one or more features on the device for determining location, such as GPS location, network location, or cell location.


android.hardware.location.gps
The app uses precise location coordinates obtained from a Global Positioning System (GPS) receiver on the device.

By using this feature, an app implies that it also uses the android.hardware.location feature, unless this parent feature is declared with the attribute android:required="false".


android.hardware.location.network
The app uses coarse location coordinates obtained from a network-based geolocation system supported on the device.

By using this feature, an app implies that it also uses the android.hardware.location feature, unless this parent feature is declared with the attribute android:required="false".

于 2016-09-22T09:53:36.193 回答