Get current location name of user without using gps or internet but by using Network_Provider in android

前端 未结 6 601
南方客
南方客 2020-12-31 08:50

This question is directly related to the same prevailing stackoverflow question at \"Android: get current location of user without using gps or internet\" where the accepted

6条回答
  •  迷失自我
    2020-12-31 09:31

    Good luck with this. It's called geocoder. Or more specifically reverse geocoding to turn coordinates into a human readable output. I'm fairly sure the one google provides is a pay service but you get a bunch free. So plan on caching the results and using your cached results when ever possible.

    List
    list = geoCoder.getFromLocation(location .getLatitude(), location.getLongitude(), 1); if (list != null & list.size() > 0) { Address address = list.get(0); result = address.getLocality(); return result;

    https://developer.android.com/training/location/display-address.html

    How to get city name from latitude and longitude coordinates in Google Maps?

提交回复
热议问题