android - GoogleApiClient is not configured to use the API required for this call -


i'm trying latitude , longitude of place using google places api.

i'm following example: google directions android

i configure client 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 here:

pendingresult<placebuffer> placeresult = places.geodataapi                     .getplacebyid(mgoogleapiclient, placeid); 

i following error:

java.lang.illegalargumentexception: googleapiclient not configured use api required call. 

how can solve it?

i have apis activated on google api console , think i'm configuring right, example.

so, after discussing @daniel, solution use 2 differents googleapiclient instances: 1 locationservices api , places api.


Comments