I am able to successfully get lat/long and pass it to the geocoder to get an Address. However, I don\'t always get an address back. Seems like it takes a couple of attempts?
If you are using Autocomplete you can get place location from Place object:
private ResultCallback mUpdatePlaceDetailsCallback
= new ResultCallback() {
@Override
public void onResult(PlaceBuffer places) {
if (!places.getStatus().isSuccess()) {
// Request did not complete successfully
AALog.e("Geocoder Place query did not complete. Error: " + places.getStatus().toString());
return;
}
// Get the Place object from the buffer.
final Place place = places.get(0);
//--------------here you can recover the place location---------------------
((DrawerActivity)getActivity()).lastPlace = place.getLatLng();
//----------------------------------------------------------------------
places.release();
getActivity().getFragmentManager().beginTransaction().remove(AutocompleteFragment.this).commit();
}
};
This callback should be registered as follow inside AdapterView.OnItemClickListener:
PendingResult placeResult = Places.GeoDataApi
.getPlaceById(mGoogleApiClient, placeId);
placeResult.setResultCallback(mUpdatePlaceDetailsCallback);