我知道如何使用GoogleApiAvailability(GCM)进行检查。但FireBase核心库不支持此功能。
我的依赖关系是:
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-messaging:9.6.1'
compile 'com.android.support:support-v4:24.2.1'
答案 0 :(得分:1)
我相信你正在寻找的是:
compile 'com.google.android.gms:play-services-auth:9.6.1'
答案 1 :(得分:-1)
也许有点晚了:)但我可以建议使用以下功能来检查Google Play服务的可用性:
private boolean checkPlayServices() {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(this, resultCode,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Log.i(LOG_TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}