Usługa niedostępna podczas wywoływania geoCoder.getFromLocation ()

głosy
26

Wiem, że czasami google obsługę back-end mogą być niedostępne.

Stąd rozwiązaniem mogłoby być pętli dopóki nie dostanę dane.

private class getLocationDetails extends AsyncTask<String, Void, String> {

    @Override
    protected String doInBackground(String... params) {

        Log.d(looping,  + count + );
        count++;
        double lat = Double.parseDouble(params[0]);
        double lng = Double.parseDouble(params[1]);
        List<Address> addresses = null;
        try {

            Geocoder gCoder = new Geocoder(ImageAndLocationActivity.this,
                    Locale.getDefault());
            addresses = gCoder.getFromLocation(lat, lng, 1);
            Address addr = addresses.get(0);
            user_country = addr.getCountryName();
            user_city = addr.getLocality();
            user_district = addr.getSubAdminArea();

            if (user_city == null) {

                user_city = user_district;
            }
        } catch (Exception e) {

            Log.e(Exception in getLocationDetails - , e.getMessage());
            return null;
        }

        return ;
    }

    @Override
    protected void onPostExecute(String result) {

        if (result != null) {

            Log.d(user_city = ,  + user_city);
        } else {

            new getLocationDetails().execute(CurrentLat + , CurrentLng
                    + );
        }
    }

    @Override
    protected void onPreExecute() {

    }

    @Override
    protected void onProgressUpdate(Void... values) {

    }
}

Ale nie jestem w stanie uzyskać miejsce na wszystko:

LogCat:

02-27 16:29:49.568: D/looping(10966): 110355
02-27 16:29:49.568: E/Exception in getLocationDetails -(10966): Service not Available
02-27 16:29:49.573: D/looping(10966): 110356
02-27 16:29:49.573: E/Exception in getLocationDetails -(10966): Service not Available
02-27 16:29:49.573: D/looping(10966): 110357
02-27 16:29:49.573: E/Exception in getLocationDetails -(10966): Service not Available

i oczywiście dodałem wszystkie potrzebne uprawnienia:

<uses-permission android:name=android.permission.INTERNET />

Próbuję to na Samsung Galaxy Note GT-N7000 (wersja 4.0.4)

Jestem brakuje żadnych ustawień? związane z urządzenia lub aplikacji? Albo to zwykle się dzieje? Jeśli więc wszelkie lepszym rozwiązaniem, aby rozwiązać to ??

Dziękuję Ci

Utwórz 27/02/2013 o 12:08
źródło użytkownik
W innych językach...                            


15 odpowiedzi

głosy
4

API rzuci „Usługa niedostępna wyjątek”, jeśli taka usługa nie jest dostępna w urządzeniu. Użyj metody isPresent()w celu sprawdzenia istnienia serwisu.

Zobacz także: http://developer.android.com/reference/android/location/Geocoder.html

Odpowiedział 27/02/2013 o 12:13
źródło użytkownik

głosy
58

Rzeczywisty powód, dlaczego Geocodernie działa dlatego, że NetworkLocatorzginął w akcji. Prawdopodobnie ze względu na mniejszą ilością pamięci czy może stosować Menedżera zadań, aby zabić wszystkich usług?

Nie jestem pewien, ale to przypuszczenie. Widziałem to już wcześniej. W ubiegłym roku pisałem mechanizm ponownie połączyć się załadować NetworkLocator.apk i wiążą się z GeocoderService. Myślę, że ta zmiana nie połączyły się Jellybean więc ten problem nie ustąpi.

To może być rozwiązany jedynie przez restarcie. (The NetworkLocationServicejest ładowany przy starcie)

Edit: Nie będzie widać ten problem w JBP lub KK, usługa ta zostanie przeniesiona do aplikacji playstore.

Odpowiedział 27/02/2013 o 13:33
źródło użytkownik

głosy
1

korzystać z tego sprawę.

po prostu edytować project.properties

# Project target
target=Google Inc.:Google APIs:16

Powodem jest to, że klasa geocoder jest obecny w rdzeniu ramach Android, ale zależy od kodu wniesionego przez API Google, aby funkcjonować poprawnie. Nawet jeśli AVD zawiera API Google, projekt nadal musi być zbudowany przed tym konkretnym celu budowania.

Odpowiedział 11/03/2013 o 15:08
źródło użytkownik

głosy
21

Obejście stosując bezpośredni dostęp do map Google:

    public static LatLng getLocationFromString(String address)
        throws JSONException {

    HttpGet httpGet = new HttpGet(
            "http://maps.google.com/maps/api/geocode/json?address="
                    + URLEncoder.encode(address, "UTF-8") + "&ka&sensor=false");
    HttpClient client = new DefaultHttpClient();
    HttpResponse response;
    StringBuilder stringBuilder = new StringBuilder();

    try {
        response = client.execute(httpGet);
        HttpEntity entity = response.getEntity();
        InputStream stream = entity.getContent();
        int b;
        while ((b = stream.read()) != -1) {
            stringBuilder.append((char) b);
        }
    } catch (ClientProtocolException e) {
    } catch (IOException e) {
    }

    JSONObject jsonObject = new JSONObject(stringBuilder.toString());

    double lng = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
            .getJSONObject("geometry").getJSONObject("location")
            .getDouble("lng");

    double lat = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
            .getJSONObject("geometry").getJSONObject("location")
            .getDouble("lat");

    return new LatLng(lat, lng);
}

    public static List<Address> getStringFromLocation(double lat, double lng)
        throws ClientProtocolException, IOException, JSONException {

    String address = String
            .format(Locale.ENGLISH,                                 "http://maps.googleapis.com/maps/api/geocode/json?latlng=%1$f,%2$f&sensor=true&language="
                            + Locale.getDefault().getCountry(), lat, lng);
    HttpGet httpGet = new HttpGet(address);
    HttpClient client = new DefaultHttpClient();
    HttpResponse response;
    StringBuilder stringBuilder = new StringBuilder();

    List<Address> retList = null;

    response = client.execute(httpGet);
    HttpEntity entity = response.getEntity();
    InputStream stream = entity.getContent();
    int b;
    while ((b = stream.read()) != -1) {
        stringBuilder.append((char) b);
    }

    JSONObject jsonObject = new JSONObject(stringBuilder.toString());

    retList = new ArrayList<Address>();

    if ("OK".equalsIgnoreCase(jsonObject.getString("status"))) {
        JSONArray results = jsonObject.getJSONArray("results");
        for (int i = 0; i < results.length(); i++) {
            JSONObject result = results.getJSONObject(i);
            String indiStr = result.getString("formatted_address");
            Address addr = new Address(Locale.getDefault());
            addr.setAddressLine(0, indiStr);
            retList.add(addr);
        }
    }

    return retList;
}
Odpowiedział 15/07/2013 o 12:48
źródło użytkownik

głosy
0

Miałem ten sam błąd, ale nie geocoder zastosowanego powyżej. Nie byłoby to jeden z moich urządzeń z systemem Android. Wtedy przypomniałem sobie, że miałem accedently zabity jakąś usługę biegu. Rozwiązaniem było wyjąć baterię na kilka sekund i ponownie go zainstalować. I to działało bez zmiany kodu :))

Odpowiedział 18/07/2013 o 13:34
źródło użytkownik

głosy
0

Niektóre urządzenia nie posiadają suport dla geocoder, więc to, co trzeba zrobić, to stworzyć swój własny geocoder.

Basicaly trzeba utworzyć zadanie asynchronicznego żądania google na adres i traktują odpowiedź JSON.

Korzystanie aquery, zrobić coś takiego:

public void asyncJson(String address){
        address = address.replace(" ", "+");

        String url = "http://maps.googleapis.com/maps/api/geocode/json?address="+ address +"&sensor=true";

        aq.ajax(url, JSONObject.class, new AjaxCallback<JSONObject>() {

                @Override
                public void callback(String url, JSONObject json, AjaxStatus status) {                        

                        if(json != null){

                                 //here you work with the response json
                                 JSONArray results = json.getJSONArray("results");                               
                                Toast.makeText(context, results.getJSONObject(1).getString("formatted_address"));

                        }else{                                
                                //ajax error, show error code
                                Toast.makeText(aq.getContext(), "Error:" + status.getCode(), Toast.LENGTH_LONG).show();
                        }
                }
        });        
}
Odpowiedział 27/11/2013 o 16:34
źródło użytkownik

głosy
-1

Miałem ten sam błąd, dodaj poniżej uprawnień, aby go rozwiązać.

<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> 
<uses-permission android:name="android.permission.INTERNET" />
Odpowiedział 19/08/2014 o 09:43
źródło użytkownik

głosy
2

Najlepszym rozwiązaniem dla tego problemu jest użycie tak samo jak klasa Google geocoder jeśli oryginał nie geocoder

List<Address> addresses = null;    
Geocoder geocoder = new Geocoder(this);
addresses = geocoder.getFromLocation(...);
if (addresses == null || addresses.isEmpty())
addresses = MyGeocoder.getFromLocation(...);


import android.location.Address;
import android.util.Log;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.params.AllClientPNames;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

public class MyGeocoder {

    public static List<Address> getFromLocation(double lat, double lng, int maxResult) {

        String address = String.format(Locale.ENGLISH, "http://maps.googleapis.com/maps/api/geocode/json?latlng=%1$f,%2$f&sensor=false&language=" + Locale.getDefault().getCountry(), lat, lng);
        HttpGet httpGet = new HttpGet(address);
        HttpClient client = new DefaultHttpClient();
        client.getParams().setParameter(AllClientPNames.USER_AGENT, "Mozilla/5.0 (Java) Gecko/20081007 java-geocoder");
        client.getParams().setIntParameter(AllClientPNames.CONNECTION_TIMEOUT, 5 * 1000);
        client.getParams().setIntParameter(AllClientPNames.SO_TIMEOUT, 25 * 1000);
        HttpResponse response;

        List<Address> retList = null;

        try {
            response = client.execute(httpGet);
            HttpEntity entity = response.getEntity();
            String json = EntityUtils.toString(entity, "UTF-8");

            JSONObject jsonObject = new JSONObject(json);

            retList = new ArrayList<Address>();

            if ("OK".equalsIgnoreCase(jsonObject.getString("status"))) {
                JSONArray results = jsonObject.getJSONArray("results");
                if (results.length() > 0) {
                    for (int i = 0; i < results.length() && i < maxResult; i++) {
                        JSONObject result = results.getJSONObject(i);
                        //Log.e(MyGeocoder.class.getName(), result.toString());
                        Address addr = new Address(Locale.getDefault());
                        // addr.setAddressLine(0, result.getString("formatted_address"));

                        JSONArray components = result.getJSONArray("address_components");
                        String streetNumber = "";
                        String route = "";
                        for (int a = 0; a < components.length(); a++) {
                            JSONObject component = components.getJSONObject(a);
                            JSONArray types = component.getJSONArray("types");
                            for (int j = 0; j < types.length(); j++) {
                                String type = types.getString(j);
                                if (type.equals("locality")) {
                                    addr.setLocality(component.getString("long_name"));
                                } else if (type.equals("street_number")) {
                                    streetNumber = component.getString("long_name");
                                } else if (type.equals("route")) {
                                    route = component.getString("long_name");
                                }
                            }
                        }
                        addr.setAddressLine(0, route + " " + streetNumber);

                        addr.setLatitude(result.getJSONObject("geometry").getJSONObject("location").getDouble("lat"));
                        addr.setLongitude(result.getJSONObject("geometry").getJSONObject("location").getDouble("lng"));
                        retList.add(addr);
                    }
                }
            }


        } catch (ClientProtocolException e) {
            Log.e(MyGeocoder.class.getName(), "Error calling Google geocode webservice.", e);
        } catch (IOException e) {
            Log.e(MyGeocoder.class.getName(), "Error calling Google geocode webservice.", e);
        } catch (JSONException e) {
            Log.e(MyGeocoder.class.getName(), "Error parsing Google geocode webservice response.", e);
        }

        return retList;
    }
}
Odpowiedział 31/10/2014 o 08:24
źródło użytkownik

głosy
4

Ponownie uruchomić urządzenie i będzie rozwiązać problem.

Odpowiedział 26/11/2014 o 09:22
źródło użytkownik

głosy
1

Usługa niedostępna - geocoder Android kiedy ja dostać ten błąd w niektórych gotowanych ROM napisałem tej biblioteki i nadzieję, że może być przydatny. https://github.com/dnocode/gapis

Odpowiedział 15/03/2015 o 15:45
źródło użytkownik

głosy
1

Używam kod, który jest w górę (bezpośredni dostęp do Google Maps) „połączone” z kodem geocoder, jak pokazano poniżej (zwrócić szczególną uwagę na „try catch”):

...
//address is String
if (address != null) {
    new GeocoderTask().execute(address);
}
...

// An AsyncTask class for accessing the GeoCoding Web Service
private class GeocoderTask extends AsyncTask<String, Void, List<Address>> {

    private LatLng latLng;
    private MarkerOptions markerOptions;

    @Override
    protected List<Address> doInBackground(String... locationName) {
        // Creating an instance of Geocoder class
        Geocoder geocoder = new Geocoder(getBaseContext());
        List<Address> addresses = null;

        try {
            // Getting a maximum of 3 Address that matches the input text
            addresses = geocoder.getFromLocationName(locationName[0], 3);
        } catch (IOException e) {
            e.printStackTrace();
            try {
                addresses = getLocationFromString(locationName[0]);
            } catch (UnsupportedEncodingException e1) {
                e1.printStackTrace();
            } catch (JSONException e1) {
                e1.printStackTrace();
            }

        }
        return addresses;
    }

    @Override
    protected void onPostExecute(List<Address> addresses) {

        if (addresses == null || addresses.size() == 0) {
            Toast.makeText(getBaseContext(), "No Location found",
                    Toast.LENGTH_SHORT).show();
            return;
        }

        // Clears all the existing markers on the map
        googleMap.clear();

        // Adding Markers on Google Map for each matching address
        for (int i = 0; i < addresses.size(); i++) {

            Address address = (Address) addresses.get(i);

            // Creating an instance of GeoPoint, to display in Google Map
            latLng = new LatLng(address.getLatitude(),
                    address.getLongitude());

            String addressText = String.format(
                    "%s, %s",
                    address.getMaxAddressLineIndex() > 0 ? address
                            .getAddressLine(0) : "", address
                            .getCountryName());

            markerOptions = new MarkerOptions();
            markerOptions.position(latLng);
            markerOptions.title(addressText);

            googleMap.addMarker(markerOptions);

            // Locate the first location
            if (i == 0) {
                CameraUpdate center = CameraUpdateFactory.newLatLng(latLng);
                CameraUpdate zoom = CameraUpdateFactory.zoomTo(13);

                googleMap.moveCamera(center);
                googleMap.animateCamera(zoom);
            }

        }

    }
}

public static LatLng getLocationFromString(String address)
    throws JSONException {

    HttpGet httpGet = new HttpGet(
        "http://maps.google.com/maps/api/geocode/json?address="
                + URLEncoder.encode(address, "UTF-8") + "&ka&sensor=false");
    HttpClient client = new DefaultHttpClient();
    HttpResponse response;
    StringBuilder stringBuilder = new StringBuilder();

    try {
    response = client.execute(httpGet);
    HttpEntity entity = response.getEntity();
    InputStream stream = entity.getContent();
    int b;
    while ((b = stream.read()) != -1) {
        stringBuilder.append((char) b);
    }
    } catch (ClientProtocolException e) {
    } catch (IOException e) {
    }

    JSONObject jsonObject = new JSONObject(stringBuilder.toString());

    double lng = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
        .getJSONObject("geometry").getJSONObject("location")
        .getDouble("lng");

    double lat = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
        .getJSONObject("geometry").getJSONObject("location")
        .getDouble("lat");

    return new LatLng(lat, lng);
}

    public static List<Address> getStringFromLocation(double lat, double lng)
    throws ClientProtocolException, IOException, JSONException {

    String address = String
        .format(Locale.ENGLISH,                                 "http://maps.googleapis.com/maps/api/geocode/json?latlng=%1$f,%2$f&sensor=true&language="
                        + Locale.getDefault().getCountry(), lat, lng);
    HttpGet httpGet = new HttpGet(address);
    HttpClient client = new DefaultHttpClient();
    HttpResponse response;
    StringBuilder stringBuilder = new StringBuilder();

    List<Address> retList = null;

    response = client.execute(httpGet);
    HttpEntity entity = response.getEntity();
    InputStream stream = entity.getContent();
    int b;
    while ((b = stream.read()) != -1) {
    stringBuilder.append((char) b);
    }

    JSONObject jsonObject = new JSONObject(stringBuilder.toString());

    retList = new ArrayList<Address>();

    if ("OK".equalsIgnoreCase(jsonObject.getString("status"))) {
    JSONArray results = jsonObject.getJSONArray("results");
    for (int i = 0; i < results.length(); i++) {
        JSONObject result = results.getJSONObject(i);
        String indiStr = result.getString("formatted_address");
        Address addr = new Address(Locale.getDefault());
        addr.setAddressLine(0, indiStr);
        retList.add(addr);
    }
    }

    return retList;
}

To działało doskonale nadaje się do mnie, bo gdy geocoder nie działa, używam bezpośredni dostęp do Google Maps.

Twoje zdrowie!

Odpowiedział 27/03/2015 o 13:21
źródło użytkownik

głosy
0

Na następnej linii

Geocoder gCoder = new Geocoder(context, Locale.getDefault());

Użyj Contextswojej działalności i nie używaćgetApplicationContext()

Odpowiedział 01/03/2017 o 10:53
źródło użytkownik

głosy
0

Ja również miałem problemy z tym błędem. Stało się to, kiedy zaktualizowane moje urządzenie do Marshmallow niedawno.

Gdybym ponownie uruchomić, działa od razu, ale wtedy się nie powiedzie, a nie działać w ogóle później.

I stworzył AsyncTask jak innych ludzi, że tylko zwraca adres z pierwszego wyniku reakcji json.

Aby skorzystać z poniższego kodu, nazywają to zbudowane z kluczem API i użyć lokalizacja obiektu jako wkład do wykonania AsyncTask. Można importować położeniem poniżej. import android.location.Location;Będziesz musiał uzyskać aktualną pozycję z LocationManager poprzez żądanie aktualizacji do niego.

    new ReverseGeoCodeTask(GOOGLE_API_KEY).execute(location);

Upewnij się, że zastąpi klucz API z własną rękę, a także upewnić się go włączyć w konsoli w chmurze Google. To, gdzie możesz zarządzać wszystkich interfejsów API Google dla konkretnego projektu.

Kopia tej klasy jako klasy Wewnętrznej w działalności, które są odwrotną, która geokodowane adres.

/**
 * Reverse geocode request - takes a Location in as parameters,
 * and does a network request in the background to get the first address in
 * json response. The address is returned in the onPostExecute so you
 * can update the UI with it
 */

private class ReverseGeoCodeTask extends AsyncTask<Location, Void, String>{

    private final static String GEOCODE_API_ENDPOINT_BASE = "https://maps.googleapis.com/maps/api/geocode/json?latlng=";
    private final static String JSON_PROPERTY_RESULTS = "results";
    private final static String JSON_PROPERTY_FORMATTED_ADDRESS = "formatted_address";
    private final static String JSON_PROPERTY_REQUEST_STATUS = "status";
    private final static String STATUS_OK = "OK";
    private String apiKey;

    public ReverseGeoCodeTask(final String apiKey){
        this.apiKey = apiKey;
    }

    @Override
    protected String doInBackground(Location... params) {

        if(apiKey == null){
            throw new IllegalStateException("Pass in a geocode api key in the ReverseGeoCoder constructor");
        }

        Location location = params[0];
        String googleGeocodeEndpoint = GEOCODE_API_ENDPOINT_BASE + location.getLatitude() + "," + location.getLongitude() + "&key=" + apiKey;
        Log.d(TAG, "Requesting gecoding endpoint : " + googleGeocodeEndpoint);
            try {
                URL url = new URL(googleGeocodeEndpoint);
                HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
                InputStream in = new BufferedInputStream(urlConnection.getInputStream());
                BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                StringBuilder result = new StringBuilder();
                String line;
                while ((line = reader.readLine()) != null) {
                    result.append(line);
                }

                JSONObject json = new JSONObject(result.toString());
                String requestStatus = json.getString(JSON_PROPERTY_REQUEST_STATUS);
                if(requestStatus.equals(STATUS_OK)){
                    JSONArray results = json.getJSONArray(JSON_PROPERTY_RESULTS);
                    if(results.length() > 0){
                        JSONObject result1 = results.getJSONObject(0);
                        String address =  result1.getString(JSON_PROPERTY_FORMATTED_ADDRESS);
                        Log.d(TAG, "First result's address : " + address );
                        return  address;


                    }
                    else{
                        Log.d(TAG, "There were no results.");
                    }
                }
                else{
                    Log.w(TAG, "Geocode request status not " + STATUS_OK + ", it was " + requestStatus );
                    Log.w(TAG, "Did you enable the geocode in the google cloud api console? Is it the right api key?");
                }


            }catch ( IOException | JSONException e){

                e.printStackTrace();
            }

        return null;
    }

    @Override
    protected void onPostExecute(String address) {
        super.onPostExecute(address);
        if(address != null){
            // update the UI here with the address, if its not null
            originEditText.setText(address);
        }
        else{
            Log.d(TAG, "Did not find an address, UI not being updated");
        }

    }
}
Odpowiedział 02/09/2017 o 20:26
źródło użytkownik

głosy
0
new Volly_Services(map, "https://maps.googleapis.com/maps/api/place/textsearch/json?query=" + mBinding.loc.getText().toString().trim() + "&key=Ap", getActivity()).vollyPostService().continueWithTask(task - > {
    mBinding.progressBaar.setVisibility(View.GONE);

    if (task.getResult() != null) {

        Log.e("<<<", "" + task.getResult());

        JSONObject jsonObject = new JSONObject("" + task.getResult());
        if ("OK".equalsIgnoreCase(jsonObject.getString("status"))) {
            JSONArray results = jsonObject.getJSONArray("results");
            if (results.length() > 0) {
                mBinding.loc.setVisibility(View.GONE);
                for (int i = 0; i < results.length(); i++) {
                    JSONObject result = results.getJSONObject(i);
                    String indiStr = result.getString("formatted_address");
                    Address addr = new Address(Locale.getDefault());

                    addr.setAddressLine(0, indiStr);
                    addr.setLocality(result.getString("name"));
                    JSONObject geometry = result.getJSONObject("geometry").getJSONObject("location");
                    addr.setLatitude(geometry.getDouble("lat"));
                    addr.setLongitude(geometry.getDouble("lng"));


                    addresses.add(addr);
                }
                adapter = new SerchLocationAdapter(getActivity(), addresses);
                mBinding.serchreg.setAdapter(adapter);
            } else {
                Toast.makeText(getActivity(), "No result found", Toast.LENGTH_LONG).show();
            }

        } else {
            Toast.makeText(getActivity(), "No result found", Toast.LENGTH_LONG).show();
        }
    } else {
        Log.e("<<<<<<", "" + task.getError().getMessage());
        Toast.makeText(getActivity(), task.getError().getMessage(), Toast.LENGTH_LONG).show();
    }
    return null;
});
Odpowiedział 23/03/2018 o 12:20
źródło użytkownik

głosy
0

Miałem ten sam problem na Androida 6 . Problem polegał na uprawnienia aplikacji . Nawet jeśli mapy działa prawidłowo należy zezwolić na „Get pozycję” zezwolenie na uprawnienia aplikacji.

Najlepszym przypadkiem jest zawsze sprawdzić to uprawnienie dozwoloną gdy można oczekiwać, aby uzyskać miejsce w wyniku.

Używam tej metody, aby uzyskać pełny adres z miejsca:

public Address getFullAddress(Place place){
    Address address;

    Locale aLocale = new Locale.Builder().setLanguage("en").build();
    Geocoder geocoder = new Geocoder(this, aLocale);

    try {
        List<Address> addresses = geocoder.getFromLocation(place.getLatLng().latitude,place.getLatLng().longitude, 1);

        address = addresses.get(0);

        return address;

    } catch (IOException e) {
        e.printStackTrace();
    }

    return null;
}
Odpowiedział 04/05/2019 o 17:22
źródło użytkownik

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more