I'm trying to get latitude and longitude of a place using Google Places API.
I'm following this example: Google Directions Android
I configure the client like that:
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Places.GEO_DATA_API)
.addApi(Places.PLACE_DETECTION_API)
.addApi(LocationServices.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
But then here:
PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi
.getPlaceById(mGoogleApiClient, placeId);
I get the following error:
java.lang.IllegalArgumentException: GoogleApiClient is not configured to use the API required for this call.
How can I solve it?
I have the APIs activated on Google API console and I think I'm configuring it right, like the example.
So, after discussing it with @Daniel, the solution is to use two differents GoogleApiClient
instances: one for LocationServices API and another for Places API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With