这是由于Google Play服务未安装或需要更新所致。您需要按照以下步骤进行操作:
以下是可能用于更新Google Play服务的代码示例:
private boolean checkGooglePlayServices() {
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if (status != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(status)) {
GooglePlayServicesUtil.getErrorDialog(status, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Toast.makeText(getApplicationContext(),
"This device is not supported.", Toast.LENGTH_LONG)
.show();
finish();
}
return false;
}
return true;
}
private void updateGooglePlayServices() {
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if (status != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(status)) {
GooglePlayServicesUtil.getErrorDialog(status, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Toast.makeText(getApplicationContext(),
"This device is not supported.", Toast.LENGTH_LONG)
.show();
finish();
}
} else {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"market://details?id=com.google.android.gms"));
startActivity(intent);
}
}