java.io.IOException: Unable to parse response from server at getFromLocationName()

Nibha Jain picture Nibha Jain · Oct 31, 2011 · Viewed 12k times · Source

I know the question has been asked frequently before ,but i am unable to get the solution from any answer or search results. I have to solve this issue ASAP .. I am trying to get the latitude and the longitude from the address enter by the user but i am continue getting :

java.io.IOException: Unable to parse response from server 

I am using this code :

        Geocoder geocoder = new Geocoder(this ,Locale.getDefault());
        String newAddress = (String)saveas.getText().toString();
        List<Address> addresses = geocoder.getFromLocationName(newAddress, 1);

I tried a lot with different possible ways but nothing works... The default map application works well, when the user enter the address it shows sucessfully that address in the map..How can i do the same..?

I have added all the required permissions and i am testing it on the real device(version 2.3)...

Answer

Olivier Bonal picture Olivier Bonal · Mar 16, 2012

Have you tried over a 3G connection? I've noticed that if you send several reverse geolocation requests from wifi, it looks like your IP is blocked after a while and the reverse geolocation won't respond for an amount of time. Switching to 3G made the request work for me when I had similar issues.