Get current location address for android app

后端 未结 3 1981
长发绾君心
长发绾君心 2020-12-13 00:42

I do not need to display a map. However, I need to use the gps/3g network to locate my current positions ADDRESS (not long and lat) this will then be added to a automated s

3条回答
  •  我在风中等你
    2020-12-13 01:31

    The answer is here: http://developer.android.com/reference/android/location/Geocoder.html

    You need to create Geocoder object and call getFromLocation(double latitude, double longitude, int maxResults)

    Geocoder gCoder = new Geocoder(myContext);
    ArrayList
    addresses = gCoder.getFromLocation(123456789, 123456789, 1); if (addresses != null && addresses.size() > 0) { Toast.makeText(myContext, "country: " + addresses.get(0).getCountryName(), Toast.LENGTH_LONG).show(); }

提交回复
热议问题