Não foi possível conectar ao cliente da API do Google
Não consigo buscar o último local conhecido. Eu ativeiAPI de geocodificação eAPI do Google Places para Android no console do google. Eu adicionei a chave api ao arquivo de manifesto:
<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" />
mas continuo recebendo uma mensagem no console: "Não foi possível conectar-se ao cliente da API do Google: ConnectionResult {statusCode = API_UNAVAILABLE, resolution = null}"
ATUALIZAR
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 eonConnectionFailed não ligue.
E eu também usoAndroid-ReactiveLocation mas ambos os métodos são enviados para o console:Não foi possível conectar-se ao cliente da API do Google: ConnectionResult {statusCode = API_UNAVAILABLE, resolution = null}