One of the features of my android application is to record the current
location name through GPS. I'm trying the following code to get it done
_lm = (LocationManager) _context.getSystemService(Context.LOCATION_SERVICE);
Criteria c = new Criteria();
_tower = _lm.getBestProvider(c, false);
Location location = _lm.getLastKnownLocation(_tower);
if(location != null) {
_longi = location.getLongitude();
_lati = location.getLatitude();
}
Geocoder gc = new Geocoder(_context, Locale.getDefault());
try {
List<Address> addresses = gc.getFromLocation(_lati, _longi, 1);
} catch (IOException ex) {
Log.e("Geocoder Exception", ex.getMessage());
}
but it ends up with the following exception
Unable to parse response from server.
Although, I'm getting correct values here for longitude and latitude. I
manually tried to locate to the point from these longitude and latitude and it
gives the correct location where I am. The exception is thrown when the
*getFromLocation()* is called for populating the list of Addresses.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en