5

I'm developing an application that rely on the web to get some location informations. Everything is working fine, except that sometimes the Internet is slow, and the Geocoder class timeout before sending the results.

Geocoder geocoder = new Geocoder(mContext, Locale.getDefault());

I tried investigating geocoder's methods, but timeout is not there. How can i fix this?


PS: addresses = geocoder.getFromLocation(lat, lon, 1); is inside asynctask's doInBackground().

Thanks.

EFK10003
  • 79
  • 2
  • 7
  • This is the error thrown : java.io.IOException: Timed out waiting for response from server at android.location.Geocoder.getFromLocation(Geocoder.java:136) 04-10 19:15:58.530: W/System.err(9387): at ReverseGeocodingTask.doInBackground(ReverseGeocodingTask.java:39) – EFK10003 Apr 10 '15 at 16:48
  • Maybe try something like the following http://stackoverflow.com/questions/23638067/geocoder-getfromlocation-function-throws-timed-out-waiting-for-server-response – Dave Truby Apr 11 '15 at 14:51
  • Thanks for your answer, i found that before but the getFromLocation function takes string address as arguments and not longitude and latitude. Is there any solution?? – EFK10003 Apr 11 '15 at 16:43
  • in the example replace http://maps.google.com/maps/api/geocode/json?address= with https://maps.googleapis.com/maps/api/geocode/json?latlng= See https://developers.google.com/maps/documentation/geocoding/#GeocodingRequests for more information. – Dave Truby Apr 14 '15 at 00:47

0 Answers0