The second quotation is telling you that you need either android.hardware.location.network
or android.hardware.location.gps
, if you specifically need one or the other location provider.
If you want updates via GPS, you need android.hardware.location.gps
.
If you want updates via the WiFi and cellular networks, you need android.hardware.location.network
.
If you want updates from both the network and GPS, you should include both <uses-feature>
elements.
If you don't specify either, your device may be installed on devices without that provider. For example, it may be installed on a device without a GPS, cellular network, or Wi-Fi chip.
In other words, getting location requires either the network location feature or the GPS feature. If you don't declare that your application needs one or the other, you may not get location updates at all.
API 21 vs 20 and below
Note that the above is only true for API 21 and above.
Prior to API 21, requesting the ACCESS_COARSE_LOCATION
permission implied the location.network
feature, wheras requesting ACCESS_FINE_LOCATION
implied the location.gps
feature (see <uses-feature>
).
The only change right now is that, for API 21+, any app requesting ACCESS_FINE_LOCATION
will soon be available to install on devices without GPS. If your app previously assumed GPS was available (and needs GPS), you need to make sure you have the explicit request for android.hardware.location.gps
.
Google says that network location providers are now good enough for a fine location, thus, the change.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…