Am problema că, dacă am încerca să obțineți o adresă cu geocoder.getFromLocationName ( „California“, 1) funcția, se fondează adresa, dar dacă l-am testat pe dispozitivul meu (Xiaomi MI5, Oreo) returnează o listă goală.
Mulțumesc anticipat!
private void geoLocate(){
Log.d(TAG, geoLocate: geolocating);
String searchString = mSearchText.getText().toString();
Log.d(TAG, geoLocate: Searching for + searchString);
Geocoder geocoder = new Geocoder(this);
List<Address> list = new ArrayList<>();
try{
if(geocoder.isPresent()){
list = geocoder.getFromLocationName(searchString,1);
} else{
Log.d(TAG, geoLocate: GEOCODER IS NOT PRESENT);
}
}catch (IOException e){
Log.e(TAG, geoLocate: IOException + e.getMessage() );
}
if(list.size() > 0 ){
Address address = list.get(0);
Log.d(TAG, geoLocate: found a location: + address.toString());
}else{
Log.d(TAG, geoLocate: Location not found);
}
}













