When do I need android.hardware.location.gps and android.hardware.location.network?

后端 未结 6 495
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 20:17

Google is informing by email of changes to the Android location permissions:

We’re making a change on October 15th, 2016 that will affect apps targeting

6条回答
  •  失恋的感觉
    2020-12-23 21:03

    On your first point:

    Based on the first quotation, I think I do not have to make any changes.

    You don't need to make any changes because you are using FusedLocation which automatically detects GPS and NetworkProvider as per availability and gives you the best estimate location (You need to add ACCESS_FINE_LOCATION permission to get High Accuracy). So even if you're targeting API above 21 you don't need to change anything in your app -FusedLocation will work as before.

    And on your second point:

    Based on the second quotation, I think I need both android.hardware.location.gps and android.hardware.location.network. Or is this only for LocationManager and not fused location?

    You just need to ignore it because you're using FusedLocation API and you are not using LocationManager API which you replaced by FusedLocation. So second Quotation is only for apps which use LocationManagar.

    NETWORK_PROVIDER and GPS_PROVIDER are part of LocationManager Not FusedLocation API

提交回复
热议问题