Estoy intentando utilizar Google Play Service en mi aplicación de Android. Como dice el documento de Google, debemos verificar si la API de Google está disponible antes de usarla. He buscado alguna forma de comprobarlo. Esto es lo que obtuve:
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
Pero cuando voy a la página de Google Api GooglePlayServicesUtil, https://developers.google.com/android/reference/com/google/android/gms/common/GooglePlayServicesUtil
Encuentro que todas las funciones están en desuso . Por ejemplo, el método
GooglePlayServicesUtil.isGooglePlayServicesAvailable (obsoleto)
Y Google recomienda usar:
GoogleApiAvailability.isGooglePlayServicesAvailable .
Sin embargo, cuando intento utilizar GoogleApiAvailability.isGooglePlayServicesAvailable, aparece el mensaje de error:

GooglePlayServicesUtilya no (lo que parece una mala práctica para una actualización "menor") pero no veo GoogleApiAvailabilityque lo use como reemplazo.