views:

764

answers:

2

The code below works perfectly for real devices running on 1.5, 1.6 and 2.0 as well as the emulator running on 2.1.

However, executing it on the Nexus One (running 2.1) raises an IOException:

java.io.IOException: Unable to parse response from server
at android.location.Geocoder.getFromLocation(Geocoder.java:124)

That's the code snippet where it happens:

Double myLatitude = AppObject.myLocation.getLatitude();
Double myLongitude = AppObject.myLocation.getLongitude();
DEBUG.i(TAG, "My location: " + myLatitude + " | " + myLongitude);
Geocoder geocoder = new Geocoder(MainActivity.this);
java.util.List<Address> addressList;
try {
    addressList = geocoder.getFromLocation(myLatitude, myLongitude, 5);
    if(addressList!=null && addressList.size()>0) {
        currentAddress = new String();
        DEBUG.i(TAG,addressList.get(0).toString());
        currentAddress = addressList.get(0).getAddressLine(0) + ", "
        + addressList.get(0).getAddressLine(1) + ", "
        + addressList.get(0).getAddressLine(2); 

    }
    return true;

} catch (IOException e) {
    e.printStackTrace();
    return false;
}
A: 

same thing happens for me on the Nexus phone, only it never works so far, always the same exce[tion...has anyone found out why this happens?

Yorgos X
sorry i was meant to write a comment and i answered by mistake..my first post on the site you see..
Yorgos X
A: 

yeesh how do I comment? I only see "Your Answer". Damn noobs :)

This looks an awful lot like a server side issue to me... but please suggest!

Running on my Droid with Android 2.1 I get behavior like this - and no I don't advocate hitting GPS or the geocoder every 10 seconds... this is a test :)

14:12:26.701,D,gps.RevGeocoder,9152,"reverseGeocode(37.3819,-122.0634)" 14:12:29.912,D,gps.LocationStringsO,9152,set() = 776 Glenborough Dr 94041 14:12:36.686,D,gps.RevGeocoder,9152,"reverseGeocode(37.3818,-122.0634)" 14:12:41.699,E,gps.RevGeocoder,9152,java.io.IOException: Unable to parse response from server 14:12:46.787,D,gps.RevGeocoder,9152,"reverseGeocode(37.3818,-122.0636)" 14:12:48.826,D,gps.LocationStringsO,9152,set() = 740 Glenborough Dr 94041 14:12:57.702,D,gps.RevGeocoder,9152,"reverseGeocode(37.3817,-122.0637)" 14:13:02.712,E,gps.RevGeocoder,9152,java.io.IOException: Unable to parse response from server 14:13:07.694,D,gps.RevGeocoder,9152,"reverseGeocode(37.3815,-122.0638)" 14:13:12.702,E,gps.RevGeocoder,9152,java.io.IOException: Unable to parse response from server 14:13:17.733,D,gps.RevGeocoder,9152,"reverseGeocode(37.3814,-122.0638)" 14:13:22.746,E,gps.RevGeocoder,9152,java.io.IOException: Unable to parse response from server 14:13:27.701,D,gps.RevGeocoder,9152,"reverseGeocode(37.3813,-122.0639)" 14:13:32.709,E,gps.RevGeocoder,9152,java.io.IOException: Unable to parse response from server 14:13:47.694,D,gps.RevGeocoder,9152,"reverseGeocode(37.3811,-122.0638)" 14:13:49.741,D,gps.LocationStringsO,9152,set() = 546 Sullivan Dr 94041

DJC
grr "Add Comment" appears below my "Answer" which is a comment... and no where else.
DJC