我正在尝试将Google Play服务库实施到我的Android应用中。但是有一个关于isGooglePlayServicesAvailable函数的问题。
虽然我的游戏服务是最新的,但根据文档,它返回2表示SERVICE_VERSION_UPDATE_REQUIRED。
我的代码如下:
@Override
protected void onResume() {
super.onResume();
int statusCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(LoginSigninActivity.this);
if( statusCode != ConnectionResult.SUCCESS)
{
Log.e("statuscode",statusCode+"");
if(GooglePlayServicesUtil.isUserRecoverableError(statusCode))
{
Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
statusCode,
LoginSigninActivity.this,
REQUEST_CODE_RECOVER_PLAY_SERVICES);
// If Google Play services can provide an error dialog
if (errorDialog != null) {
errorDialog.show();
}
}
else
{
Toast.makeText(this, getString(R.string.toast_google_play_services_not_found),Toast.LENGTH_LONG).show();
}
}
}
提前致谢。
P.S。始终显示错误对话框。
答案 0 :(得分:2)
不,不应该。
使用android 4.4.4的设备具有播放服务版本5.0.89,其中具有android L预览的设备具有播放服务版本5.2.08。这就是android studio要求您将播放服务版本更新为5.2.08的原因。所以,现在使用
compile 'com.google.android.gms:play-services:5.0.89'
如果您使用的是Android L模拟器,我认为您应该使用5.2.08。
如果您想将播放服务更新为5.2,请参阅this。
答案 1 :(得分:0)
我也面临同样的问题。我使用最新的播放服务版本:5. +开发可能的应用程序。但我的设备有Kitkat使用播放服务版本:4.4.52。它总是说SERVICE_VERSION_UPDATE_REQUIRED
,因为我构建的应用程序使用较高版本的播放服务,但设备的版本较低。
我的建议是使用较低游戏服务版本来开发您的应用程序或使用使用较高版本的游戏服务的设备。