android - Couldn't connect to Google API client -
i can't fetch last known location. have enabled geocoding api , google places api android in google console. added api key manifest file:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.geo.api_key" android:value="@string/google_api_key" />
but keep getting message in console: "couldn't connect google api client: connectionresult{statuscode=api_unavailable, resolution=null}"
update
protected synchronized void buildgoogleapiclient() { mgoogleapiclient = new googleapiclient.builder(this) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .addapi(locationservices.api) .build(); } @override public void onconnected(bundle connectionhint) { location mlastlocation = locationservices.fusedlocationapi.getlastlocation( mgoogleapiclient); if (mlastlocation != null) { toast.maketext(this, "latitude = " + mlastlocation.getlatitude() + "\n" + "longitude = " + mlastlocation.getlongitude(), toast.length_long).show(); } } @override public void onconnectionfailed(connectionresult connectionresult) { toast.maketext(this, connectionresult.tostring(), toast.length_long).show(); }
onconnected , onconnectionfailed not call.
and use android-reactivelocation both methods output console: couldn't connect google api client: connectionresult{statuscode=api_unavailable, resolution=null}
i had same problem
couldn't connect google api client: connectionresult{statuscode=api_unavailable, resolution=null}
because google places api android
not enabled in api console.
Comments
Post a Comment