Java Code Examples for com.google.android.gms.games.GamesActivityResultCodes#RESULT_SIGN_IN_FAILED

The following examples show how to use com.google.android.gms.games.GamesActivityResultCodes#RESULT_SIGN_IN_FAILED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GameHelperUtils.java    From cordova-google-play-games-services with MIT License 6 votes vote down vote up
static String activityResponseCodeToString(int respCode) {
    switch (respCode) {
        case Activity.RESULT_OK:
            return "RESULT_OK";
        case Activity.RESULT_CANCELED:
            return "RESULT_CANCELED";
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            return "RESULT_APP_MISCONFIGURED";
        case GamesActivityResultCodes.RESULT_LEFT_ROOM:
            return "RESULT_LEFT_ROOM";
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            return "RESULT_LICENSE_FAILED";
        case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
            return "RESULT_RECONNECT_REQUIRED";
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            return "SIGN_IN_FAILED";
        default:
            return String.valueOf(respCode);
    }
}
 
Example 2
Source File: GameHelperUtils.java    From ColorPhun with Apache License 2.0 6 votes vote down vote up
static String activityResponseCodeToString(int respCode) {
    switch (respCode) {
        case Activity.RESULT_OK:
            return "RESULT_OK";
        case Activity.RESULT_CANCELED:
            return "RESULT_CANCELED";
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            return "RESULT_APP_MISCONFIGURED";
        case GamesActivityResultCodes.RESULT_LEFT_ROOM:
            return "RESULT_LEFT_ROOM";
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            return "RESULT_LICENSE_FAILED";
        case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
            return "RESULT_RECONNECT_REQUIRED";
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            return "SIGN_IN_FAILED";
        default:
            return String.valueOf(respCode);
    }
}
 
Example 3
Source File: GameHelperUtils.java    From google-play-game-services-ane with MIT License 6 votes vote down vote up
static String activityResponseCodeToString(int respCode) {
    switch (respCode) {
        case Activity.RESULT_OK:
            return "RESULT_OK";
        case Activity.RESULT_CANCELED:
            return "RESULT_CANCELED";
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            return "RESULT_APP_MISCONFIGURED";
        case GamesActivityResultCodes.RESULT_LEFT_ROOM:
            return "RESULT_LEFT_ROOM";
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            return "RESULT_LICENSE_FAILED";
        case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
            return "RESULT_RECONNECT_REQUIRED";
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            return "SIGN_IN_FAILED";
        default:
            return String.valueOf(respCode);
    }
}
 
Example 4
Source File: GameHelperUtils.java    From io2014-codelabs with Apache License 2.0 6 votes vote down vote up
static String activityResponseCodeToString(int respCode) {
    switch (respCode) {
        case Activity.RESULT_OK:
            return "RESULT_OK";
        case Activity.RESULT_CANCELED:
            return "RESULT_CANCELED";
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            return "RESULT_APP_MISCONFIGURED";
        case GamesActivityResultCodes.RESULT_LEFT_ROOM:
            return "RESULT_LEFT_ROOM";
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            return "RESULT_LICENSE_FAILED";
        case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
            return "RESULT_RECONNECT_REQUIRED";
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            return "SIGN_IN_FAILED";
        default:
            return String.valueOf(respCode);
    }
}
 
Example 5
Source File: GameHelperUtils.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
static String activityResponseCodeToString(int respCode) {
    switch (respCode) {
        case Activity.RESULT_OK:
            return "RESULT_OK";
        case Activity.RESULT_CANCELED:
            return "RESULT_CANCELED";
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            return "RESULT_APP_MISCONFIGURED";
        case GamesActivityResultCodes.RESULT_LEFT_ROOM:
            return "RESULT_LEFT_ROOM";
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            return "RESULT_LICENSE_FAILED";
        case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
            return "RESULT_RECONNECT_REQUIRED";
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            return "SIGN_IN_FAILED";
        default:
            return String.valueOf(respCode);
    }
}
 
Example 6
Source File: GameHelperUtils.java    From FlappyCow with MIT License 6 votes vote down vote up
static String activityResponseCodeToString(int respCode) {
    switch (respCode) {
        case Activity.RESULT_OK:
            return "RESULT_OK";
        case Activity.RESULT_CANCELED:
            return "RESULT_CANCELED";
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            return "RESULT_APP_MISCONFIGURED";
        case GamesActivityResultCodes.RESULT_LEFT_ROOM:
            return "RESULT_LEFT_ROOM";
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            return "RESULT_LICENSE_FAILED";
        case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
            return "RESULT_RECONNECT_REQUIRED";
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            return "SIGN_IN_FAILED";
        default:
            return String.valueOf(respCode);
    }
}
 
Example 7
Source File: BaseGameUtils.java    From Trivia-Knowledge with Apache License 2.0 5 votes vote down vote up
/**
 * Show a {@link android.app.Dialog} with the correct message for a connection error.
 *  @param activity the Activity in which the Dialog should be displayed.
 * @param requestCode the request code from onActivityResult.
 * @param actResp the response code from onActivityResult.
 * @param errorDescription the resource id of a String for a generic error message.
 */
public static void showActivityResultError(Activity activity, int requestCode, int actResp, int errorDescription) {
    if (activity == null) {
        Log.e("BaseGameUtils", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.app_misconfigured));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.sign_in_failed));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.license_failed));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            final int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, requestCode, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("BaseGamesUtils",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(activity, activity.getString(errorDescription));
            }
    }

    errorDialog.show();
}
 
Example 8
Source File: BaseGameUtils.java    From Onesearch with MIT License 5 votes vote down vote up
/**
 * Show a {@link android.app.Dialog} with the correct message for a connection error.
 *  @param activity the Activity in which the Dialog should be displayed.
 * @param requestCode the request code from onActivityResult.
 * @param actResp the response code from onActivityResult.
 * @param errorDescription the resource id of a String for a generic error message.
 */
public static void showActivityResultError(Activity activity, int requestCode, int actResp, int errorDescription) {
    if (activity == null) {
        Log.e("BaseGameUtils", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.app_misconfigured));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.sign_in_failed));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.license_failed));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            final int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, requestCode, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("BaseGamesUtils",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(activity, activity.getString(errorDescription));
            }
    }

    errorDialog.show();
}
 
Example 9
Source File: BaseGameUtils.java    From FixMath with Apache License 2.0 5 votes vote down vote up
/**
 * Show a {@link android.app.Dialog} with the correct message for a connection error.
 *  @param activity the Activity in which the Dialog should be displayed.
 * @param requestCode the request code from onActivityResult.
 * @param actResp the response code from onActivityResult.
 * @param errorDescription the resource id of a String for a generic error message.
 */
public static void showActivityResultError(Activity activity, int requestCode, int actResp, int errorDescription) {
    if (activity == null) {
        Log.e("BaseGameUtils", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.app_misconfigured));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.sign_in_failed));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.license_failed));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            final int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, requestCode, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("BaseGamesUtils",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(activity, activity.getString(errorDescription));
            }
    }

    errorDialog.show();
}
 
Example 10
Source File: BaseGameUtils.java    From android with Apache License 2.0 5 votes vote down vote up
/**
 * Show a {@link android.app.Dialog} with the correct message for a connection error.
 *
 * @param activity         the Activity in which the Dialog should be displayed.
 * @param requestCode      the request code from onActivityResult.
 * @param actResp          the response code from onActivityResult.
 * @param errorDescription the resource id of a String for a generic error message.
 */
public static void showActivityResultError(Activity activity, int requestCode, int actResp,
    int errorDescription) {
  if (activity == null) {
    Log.e(TAG, "*** No Activity. Can't show failure dialog!");
    return;
  }
  Dialog errorDialog;

  switch (actResp) {
    case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
      errorDialog = makeSimpleDialog(activity,
          activity.getString(R.string.app_misconfigured));
      break;
    case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
      errorDialog = makeSimpleDialog(activity,
          activity.getString(R.string.sign_in_failed));
      break;
    case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
      errorDialog = makeSimpleDialog(activity,
          activity.getString(R.string.license_failed));
      break;
    default:
      // No meaningful Activity response code, so generate default Google
      // Play services dialog
      final int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
      errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
          activity, requestCode, null);
      if (errorDialog == null) {
        // get fallback dialog
        Log.e(TAG,
            "No standard error dialog available. Making fallback dialog.");
        errorDialog = makeSimpleDialog(activity, activity.getString(errorDescription));
      }
  }

  errorDialog.show();
}
 
Example 11
Source File: BaseGameUtils.java    From Asteroid with Apache License 2.0 5 votes vote down vote up
/**
 * Show a {@link android.app.Dialog} with the correct message for a connection error.
 *
 * @param activity         the Activity in which the Dialog should be displayed.
 * @param requestCode      the request code from onActivityResult.
 * @param actResp          the response code from onActivityResult.
 * @param errorDescription the resource id of a String for a generic error message.
 */
public static void showActivityResultError(AppCompatActivity activity, int requestCode, int actResp, int errorDescription) {
    if (activity == null) {
        Log.e("BaseGameUtils", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.app_misconfigured));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.sign_in_failed));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.license_failed));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            final int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, requestCode, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("BaseGamesUtils",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(activity, activity.getString(errorDescription));
            }
    }

    errorDialog.show();
}
 
Example 12
Source File: GameHelper.java    From google-play-game-services-ane with MIT License 5 votes vote down vote up
/** Shows an error dialog that's appropriate for the failure reason. */
public static void showFailureDialog(Activity activity, int actResp, int errorCode) {
    if (activity == null) {
        Log.e("GameHelper", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog = null;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(activity,
                    GameHelperUtils.R_APP_MISCONFIGURED));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(activity,
                    GameHelperUtils.R_SIGN_IN_FAILED));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(activity,
                    GameHelperUtils.R_LICENSE_FAILED));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, activity,
                    RC_UNUSED, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("GameHelper", "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(activity,
                        GameHelperUtils.getString(activity, GameHelperUtils.R_UNKNOWN_ERROR)
                        + " " + GameHelperUtils.errorCodeToString(errorCode));
            }
    }

    errorDialog.show();
}
 
Example 13
Source File: BaseGameUtils.java    From FlappyCow with MIT License 5 votes vote down vote up
/**
 * Show a {@link android.app.Dialog} with the correct message for a connection error.
 *  @param activity the Activity in which the Dialog should be displayed.
 * @param requestCode the request code from onActivityResult.
 * @param actResp the response code from onActivityResult.
 * @param errorDescription the resource id of a String for a generic error message.
 */
public static void showActivityResultError(Activity activity, int requestCode, int actResp, int errorDescription) {
    if (activity == null) {
        Log.e("BaseGameUtils", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.app_misconfigured));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.sign_in_failed));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity,
                    activity.getString(R.string.license_failed));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            final int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, requestCode, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("BaseGamesUtils",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(activity, activity.getString(errorDescription));
            }
    }

    errorDialog.show();
}
 
Example 14
Source File: GameHelper.java    From ANE-Google-Play-Game-Services with Apache License 2.0 4 votes vote down vote up
/** Shows an error dialog that's appropriate for the failure reason. */
public static void showFailureDialog(Activity activity, int actResp,
                                     int errorCode) {
    if (activity == null) {
        Log.e("GameHelper", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog = null;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_APP_MISCONFIGURED));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_SIGN_IN_FAILED));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_LICENSE_FAILED));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, RC_UNUSED, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("GameHelper",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(
                        activity,
                        GameHelperUtils.getString(activity,
                                GameHelperUtils.R_UNKNOWN_ERROR)
                                + " "
                                + GameHelperUtils.errorCodeToString(errorCode));
            }
    }

    errorDialog.show();
}
 
Example 15
Source File: GameHelper.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
/** Shows an error dialog that's appropriate for the failure reason. */
public static void showFailureDialog(Activity activity, int actResp,
                                     int errorCode) {
    if (activity == null) {
        Log.e("GameHelper", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog = null;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_APP_MISCONFIGURED));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_SIGN_IN_FAILED));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_LICENSE_FAILED));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, RC_UNUSED, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("GameHelper",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(
                        activity,
                        GameHelperUtils.getString(activity,
                                GameHelperUtils.R_UNKNOWN_ERROR)
                                + " "
                                + GameHelperUtils.errorCodeToString(errorCode));
            }
    }

    errorDialog.show();
}
 
Example 16
Source File: GameHelper.java    From tedroid with Apache License 2.0 4 votes vote down vote up
/** Shows an error dialog that's appropriate for the failure reason. */
public static void showFailureDialog(Activity activity, int actResp,
                                     int errorCode) {
    if (activity == null) {
        Log.e("GameHelper", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog = null;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_APP_MISCONFIGURED));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_SIGN_IN_FAILED));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_LICENSE_FAILED));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, RC_UNUSED, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("GameHelper",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(
                        activity,
                        GameHelperUtils.getString(activity,
                                GameHelperUtils.R_UNKNOWN_ERROR)
                                + " "
                                + GameHelperUtils.errorCodeToString(errorCode));
            }
    }

    errorDialog.show();
}
 
Example 17
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 4 votes vote down vote up
/** Shows an error dialog that's appropriate for the failure reason. */
public static void showFailureDialog(Activity activity, int actResp,
        int errorCode) {
    if (activity == null) {
        Log.e("GameHelper", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog = null;

    switch (actResp) {
    case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
        errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                activity, GameHelperUtils.R_APP_MISCONFIGURED));
        break;
    case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
        errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                activity, GameHelperUtils.R_SIGN_IN_FAILED));
        break;
    case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
        errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                activity, GameHelperUtils.R_LICENSE_FAILED));
        break;
    default:
        // No meaningful Activity response code, so generate default Google
        // Play services dialog
        errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                activity, RC_UNUSED, null);
        if (errorDialog == null) {
            // get fallback dialog
            Log.e("GameHelper",
                    "No standard error dialog available. Making fallback dialog.");
            errorDialog = makeSimpleDialog(
                    activity,
                    GameHelperUtils.getString(activity,
                            GameHelperUtils.R_UNKNOWN_ERROR)
                            + " "
                            + GameHelperUtils.errorCodeToString(errorCode));
        }
    }

    errorDialog.show();
}
 
Example 18
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 4 votes vote down vote up
/** Shows an error dialog that's appropriate for the failure reason. */
public static void showFailureDialog(Activity activity, int actResp,
        int errorCode) {
    if (activity == null) {
        Log.e("GameHelper", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog = null;

    switch (actResp) {
    case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
        errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                activity, GameHelperUtils.R_APP_MISCONFIGURED));
        break;
    case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
        errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                activity, GameHelperUtils.R_SIGN_IN_FAILED));
        break;
    case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
        errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                activity, GameHelperUtils.R_LICENSE_FAILED));
        break;
    default:
        // No meaningful Activity response code, so generate default Google
        // Play services dialog
        errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                activity, RC_UNUSED, null);
        if (errorDialog == null) {
            // get fallback dialog
            Log.e("GameHelper",
                    "No standard error dialog available. Making fallback dialog.");
            errorDialog = makeSimpleDialog(
                    activity,
                    GameHelperUtils.getString(activity,
                            GameHelperUtils.R_UNKNOWN_ERROR)
                            + " "
                            + GameHelperUtils.errorCodeToString(errorCode));
        }
    }

    errorDialog.show();
}
 
Example 19
Source File: GameHelper.java    From martianrun with Apache License 2.0 4 votes vote down vote up
/**
 * Shows an error dialog that's appropriate for the failure reason.
 */
public static void showFailureDialog(Activity activity, int actResp,
                                     int errorCode) {
    if (activity == null) {
        Log.e("GameHelper", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog = null;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_APP_MISCONFIGURED));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_SIGN_IN_FAILED));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_LICENSE_FAILED));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, RC_UNUSED, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("GameHelper",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(
                        activity,
                        GameHelperUtils.getString(activity,
                                GameHelperUtils.R_UNKNOWN_ERROR)
                                + " "
                                + GameHelperUtils.errorCodeToString(errorCode));
            }
    }

    errorDialog.show();
}
 
Example 20
Source File: GameHelper.java    From Asteroid with Apache License 2.0 4 votes vote down vote up
/**
 * Shows an error dialog that's appropriate for the failure reason.
 */
public static void showFailureDialog(AppCompatActivity activity, int actResp,
                                     int errorCode) {
    if (activity == null) {
        Log.e("GameHelper", "*** No Activity. Can't show failure dialog!");
        return;
    }
    Dialog errorDialog;

    switch (actResp) {
        case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_APP_MISCONFIGURED));
            break;
        case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_SIGN_IN_FAILED));
            break;
        case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
            errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(
                    activity, GameHelperUtils.R_LICENSE_FAILED));
            break;
        default:
            // No meaningful Activity response code, so generate default Google
            // Play services dialog
            errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                    activity, RC_UNUSED, null);
            if (errorDialog == null) {
                // get fallback dialog
                Log.e("GameHelper",
                        "No standard error dialog available. Making fallback dialog.");
                errorDialog = makeSimpleDialog(
                        activity,
                        GameHelperUtils.getString(activity,
                                GameHelperUtils.R_UNKNOWN_ERROR)
                                + " "
                                + GameHelperUtils.errorCodeToString(errorCode));
            }
    }

    errorDialog.show();
}