【发布时间】:2014-09-23 16:16:04
【问题描述】:
我正在尝试在我的 Android 应用中实现 Google Play 服务库。但是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();
}
}
}
提前致谢。
附:始终显示错误对话框。
【问题讨论】:
-
你能告诉我们logcat错误吗?上面写着“需要 xxxxx,但找到了 yyyyyy”?
标签: android google-play-services