相关疑难解决方法(0)

GooglePlayServicesUtil与GoogleApiAvailability

我想在我的Android应用中使用Google Play服务.正如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;
}
Run Code Online (Sandbox Code Playgroud)

但是,当我访问Google Api GooglePlayServicesUtil页面时, 请访问https://developers.google.com/android/reference/com/google/android/gms/common/GooglePlayServicesUtil

我发现所有功能都已弃用.例如,该方法

GooglePlayServicesUtil.isGooglePlayServicesAvailable(不建议使用)

谷歌建议使用:

GoogleApiAvailability.isGooglePlayServicesAvailable.

但是,当我尝试使用GoogleApiAvailability.isGooglePlayServicesAvailable时,收到错误消息:

在此输入图像描述

android

100
推荐指数
4
解决办法
5万
查看次数

如何确保我的应用支持最低版Google Play Services 4.1版本?

如果安装的Google Play服务版本为4.1+,我在检查Google Play服务可用性时需要获取ConnectionResult.SUCCESS:

int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
Run Code Online (Sandbox Code Playgroud)

目前,当Google Play服务版本为5.0.84时,我正在设置代码== ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED.

我知道我所需要的只是添加一些标签,以显示女巫应该包括GooglePlayServices版本代码.但我不知道巫婆一和4.1版本号是什么.请指教.

android google-play-services

2
推荐指数
1
解决办法
1321
查看次数

标签 统计

android ×2

google-play-services ×1