If I have ACCESS_FINE_LOCATION already, can I omit ACCESS_COARSE_LOCATION?

后端 未结 2 1325
独厮守ぢ
独厮守ぢ 2020-12-13 12:05

I have a GPS app that already requests ACCESS_FINE_LOCATION permission in the manifest, now I want to add a library (MoPub) that requires ACCESS_COARSE_L

2条回答
  •  被撕碎了的回忆
    2020-12-13 12:33

    Depends on your need.

    Permission wise, ACCESS_FINE_LOCATION includes ACCESS_COARSE_LOCATION. However, there is a catch:

    ACCESS_COARSE_LOCATION gives you last-known location which is battery friendly https://developer.android.com/training/location/retrieve-current.html#setup
    For example, if your app does something like location-based recommendations, last-known location is good enough.
    This has a dependency on Google Play Services

    However, if you need something like live/ real-time location like Pokemon Go, use ACCESS_FINE_LOCATION
    It gives you live/ real-time location. You'll need to use a LocationListener
    Last time I checked, this does not require Google Play Services

提交回复
热议问题