我正試圖將Google Play服務庫實現到我的Android應用程序。但是有一個關於isGooglePlayServicesAvailable函數的問題。是GooglePlayServicesAvailable總是返回2
雖然我的播放服務是最新的,但它返回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.錯誤對話框始終顯示。
你能告訴我們這個logcat錯誤嗎?這就像「需要XXXXX,但找到YYYYYY」? – 2014-09-23 07:55:18