我正在尝试在我的 Android 应用程序中使用 Google Play Service。正如 Google 文档所说,在使用 Google API 之前,我们需要检查它是否可用。我已经想办法检查过了。以下是我得到的信息:
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;
}
但当我打开谷歌 Api GooglePlayServicesUtil 页面时, Https://developers.google.com/android/reference/com/google/android/gms/common/googleplayservicesutil
我发现所有的函数都是 不赞成
IsGooglePlayServicesUpable (弃用)
谷歌建议使用:
IsGooglePlayServices.
但是,当我尝试使用 GoogleApiiliability.isGooglePlayServices ,我得到了一个错误消息: