I am searching the place in my apps using the google autocomplete place api and now I want to get latitude and longitude of the place that i have searched. How to get latitude a
The following code snippet which uses Google Places API for android worked for me
Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId)
.setResultCallback(new ResultCallback() {
@Override
public void onResult(PlaceBuffer places) {
if (places.getStatus().isSuccess()) {
final Place myPlace = places.get(0);
LatLng queriedLocation = myPlace.getLatLng();
Log.v("Latitude is", "" + queriedLocation.latitude);
Log.v("Longitude is", "" + queriedLocation.longitude);
}
places.release();
}
});
Visit Google Places API for Android for a full list of methods to retrieve data from a place