When should I use ACCESS_COARSE_LOCATION permission?

后端 未结 5 880
抹茶落季
抹茶落季 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 14:00

    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 This has a dependency on Google Play Services

    However, if you need something like live/ real-time location, use ACCESS_FINE_LOCATION It gives you live/ real-time location. You'll need to use a LocationListener though.

提交回复
热议问题