When should I use ACCESS_COARSE_LOCATION permission?

后端 未结 5 997
抹茶落季
抹茶落季 2021-01-31 13:31

I am building an Android app that will track the user\'s geolocation and draw their route on a map.

I am using the Google Play Services location API, as described here.<

5条回答
  •  我在风中等你
    2021-01-31 13:42

    Do I also need the ACCESS_COARSE_LOCATION permission?

    No.

    What's the use case where I need the coarse location?

    If you do not ask for ACCESS_FINE_LOCATION, but you need location data, and you are willing for that data to be fuzzy (say, up to around a city block from the user's position). In the case of LocationManager, you can only use the NETWORK_PROVIDER; in the case of the Play Services fused location provider, they should handle this internally.

    Once upon a time, long long ago, users were told at install time whether the app wanted coarse or fine location access. Users might accept apps that wanted coarse access but reject apps that wanted fine access.

    Since the UI for this has changed, and users would have a fair bit of difficulty determining whether an app wants coarse or fine location permission, I suspect that most developers just ask for fine location permission. That being said, if you know that your app does not need that level of accuracy (e.g., you want the location for a weather forecast), asking for coarse location permission is a nice "tip of the hat" in the direction of privacy and may prove beneficial once again in the future.

提交回复
热议问题