本文整理匯總了Java中com.google.android.gms.common.ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED屬性的典型用法代碼示例。如果您正苦於以下問題:Java ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED屬性的具體用法?Java ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED怎麽用?Java ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.google.android.gms.common.ConnectionResult
的用法示例。
在下文中一共展示了ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkGooglePlayServices
public static boolean checkGooglePlayServices(final Activity activity) {
final int googlePlayServicesCheck = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
switch (googlePlayServicesCheck) {
case ConnectionResult.SUCCESS:
return true;
case ConnectionResult.SERVICE_DISABLED:
case ConnectionResult.SERVICE_INVALID:
case ConnectionResult.SERVICE_MISSING:
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(googlePlayServicesCheck, activity, 0);
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
activity.finish();
}
});
dialog.show();
}
return false;
}
示例2: checkPlayServices
private static boolean checkPlayServices(Activity activity) {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
return resultCode == ConnectionResult.SUCCESS || resultCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED;
// if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
// GooglePlayServicesUtil.getErrorDialog(resultCode, activity, PLAY_SERVICES_RESOLUTION_REQUEST).show();
// } else {
// Log.w(TAG, "Unable to install Play Services.");
// }
}
示例3: checkPlayServices
private PlayServicesStatus checkPlayServices(Context context) {
int gcmStatus = 0;
try {
gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
} catch (Throwable t) {
Log.w(TAG, t);
return PlayServicesStatus.MISSING;
}
Log.w(TAG, "Play Services: " + gcmStatus);
switch (gcmStatus) {
case ConnectionResult.SUCCESS:
return PlayServicesStatus.SUCCESS;
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
return PlayServicesStatus.NEEDS_UPDATE;
case ConnectionResult.SERVICE_DISABLED:
case ConnectionResult.SERVICE_MISSING:
case ConnectionResult.SERVICE_INVALID:
case ConnectionResult.API_UNAVAILABLE:
case ConnectionResult.SERVICE_MISSING_PERMISSION:
return PlayServicesStatus.MISSING;
default:
return PlayServicesStatus.TRANSIENT_ERROR;
}
}
示例4: errorCodeToString
static String errorCodeToString(int errorCode) {
switch (errorCode) {
case ConnectionResult.DEVELOPER_ERROR:
return "DEVELOPER_ERROR(" + errorCode + ")";
case ConnectionResult.INTERNAL_ERROR:
return "INTERNAL_ERROR(" + errorCode + ")";
case ConnectionResult.INVALID_ACCOUNT:
return "INVALID_ACCOUNT(" + errorCode + ")";
case ConnectionResult.LICENSE_CHECK_FAILED:
return "LICENSE_CHECK_FAILED(" + errorCode + ")";
case ConnectionResult.NETWORK_ERROR:
return "NETWORK_ERROR(" + errorCode + ")";
case ConnectionResult.RESOLUTION_REQUIRED:
return "RESOLUTION_REQUIRED(" + errorCode + ")";
case ConnectionResult.SERVICE_DISABLED:
return "SERVICE_DISABLED(" + errorCode + ")";
case ConnectionResult.SERVICE_INVALID:
return "SERVICE_INVALID(" + errorCode + ")";
case ConnectionResult.SERVICE_MISSING:
return "SERVICE_MISSING(" + errorCode + ")";
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
return "SERVICE_VERSION_UPDATE_REQUIRED(" + errorCode + ")";
case ConnectionResult.SIGN_IN_REQUIRED:
return "SIGN_IN_REQUIRED(" + errorCode + ")";
case ConnectionResult.SUCCESS:
return "SUCCESS(" + errorCode + ")";
default:
return "Unknown error code " + errorCode;
}
}
示例5: onConnectionFailed
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
ToastLog.warnShort(context, TAG, "Google API failed.");
switch (connectionResult.getErrorCode()) {
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED: // SERVICE_VERSION_UPDATE_REQUIRED
break;
}
}
示例6: isGooglePlayServicesUpdateRequiredError
/**
* @param errorCode returned by {@link #checkGooglePlayServicesAvailable(Context)}.
* @return true if the error code indicates that an invalid version of Google Play Services is
* installed.
*/
public boolean isGooglePlayServicesUpdateRequiredError(int errorCode) {
return errorCode == ConnectionResult.SERVICE_UPDATING
|| errorCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
|| errorCode == ConnectionResult.SERVICE_DISABLED
|| errorCode == ConnectionResult.SERVICE_MISSING;
}