Declare the object as
GoogleApiClient mGoogleApiClient;
Then initialise it as
mGoogleApiClient =
new GoogleApiClient.Builder(...)
...
.build();
And pass it to the Places API's function.
Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId)
.setResultCallback(new ResultCallback<PlaceBuffer>() {
@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();
}
});
And retrieve the coordinates in the callback. (code copied from here)