當前位置: 首頁>>代碼示例>>Java>>正文


Java ConnectionResult.SERVICE_DISABLED屬性代碼示例

本文整理匯總了Java中com.google.android.gms.common.ConnectionResult.SERVICE_DISABLED屬性的典型用法代碼示例。如果您正苦於以下問題:Java ConnectionResult.SERVICE_DISABLED屬性的具體用法?Java ConnectionResult.SERVICE_DISABLED怎麽用?Java ConnectionResult.SERVICE_DISABLED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.android.gms.common.ConnectionResult的用法示例。


在下文中一共展示了ConnectionResult.SERVICE_DISABLED屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:20,代碼來源:PlayServicesUtils.java

示例2: 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;
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:27,代碼來源:RegistrationActivity.java

示例3: 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;
    }
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:30,代碼來源:GameHelperUtils.java

示例4: 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;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:11,代碼來源:ExternalAuthUtils.java


注:本文中的com.google.android.gms.common.ConnectionResult.SERVICE_DISABLED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。