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

The following examples show how to use com.google.android.gms.games.GamesActivityResultCodes#RESULT_LEFT_ROOM . 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 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 2
Source File: GameHelperUtils.java    From ANE-Google-Play-Game-Services 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 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 4
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 5
Source File: GameHelperUtils.java    From tedroid 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 6
Source File: GameHelperUtils.java    From Onesearch 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: 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 8
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 9
Source File: GameHelperUtils.java    From Asteroid with Apache License 2.0 6 votes vote down vote up
static String activityResponseCodeToString(int respCode) {
    switch (respCode) {
        case AppCompatActivity.RESULT_OK:
            return "RESULT_OK";
        case AppCompatActivity.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 10
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 11
Source File: GameHelperUtils.java    From martianrun 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 12
Source File: GameHelperUtils.java    From FixMath 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 13
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 14
Source File: GameHelperUtils.java    From Trivia-Knowledge 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 15
Source File: DrawingActivity.java    From 8bitartist with Apache License 2.0 4 votes vote down vote up
@Override
public void onActivityResult(int request, int response, Intent data) {
    super.onActivityResult(request, response, data);
    Log.i(TAG, "onActivityResult: code = " + request + ", response = " + response);

    // Coming back from resolving a sign-in request
    if (request == RC_SIGN_IN) {
        mSignInClicked = false;
        mResolvingConnectionFailure = false;
        if (response == RESULT_OK) {
            mGoogleApiClient.connect();
        } else {
            BaseGameUtils.showActivityResultError(this, request, response,
                    R.string.sign_in_failed);
        }
    }

    // Coming back from a RealTime Multiplayer waiting room
    if (request == RC_WAITING_ROOM) {
        dismissSpinner();

        Room room = data.getParcelableExtra(Multiplayer.EXTRA_ROOM);
        if (response == RESULT_OK) {
            Log.d(TAG, "Waiting Room: Success");
            mRoom = room;
            startMatch();
        } else if (response == RESULT_CANCELED) {
            Log.d(TAG, "Waiting Room: Canceled");
            leaveRoom();
        } else if (response == GamesActivityResultCodes.RESULT_LEFT_ROOM) {
            Log.d(TAG, "Waiting Room: Left Room");
            leaveRoom();
        } else if (response == GamesActivityResultCodes.RESULT_INVALID_ROOM) {
            Log.d(TAG, "Waiting Room: Invalid Room");
            leaveRoom();
        }
    }

    // We are coming back from the player selection UI, in preparation to start a match.
    if (request == RC_SELECT_PLAYERS) {
        if (response != Activity.RESULT_OK) {
            // user canceled
            Log.d(TAG, "onActivityResult: user canceled player selection.");
            return;
        }

        // Create a basic room configuration
        RoomConfig.Builder roomConfigBuilder = RoomConfig.builder(this)
                .setMessageReceivedListener(this)
                .setRoomStatusUpdateListener(this);

        // Set the auto match criteria
        int minAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0);
        int maxAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0);
        if (minAutoMatchPlayers > 0 || maxAutoMatchPlayers > 0) {
            Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(
                    minAutoMatchPlayers, maxAutoMatchPlayers, 0);
            roomConfigBuilder.setAutoMatchCriteria(autoMatchCriteria);
        }

        // Set the invitees
        final ArrayList<String> invitees = data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS);
        if (invitees != null && invitees.size() > 0) {
            roomConfigBuilder.addPlayersToInvite(invitees);
        }

        // Build the room and start the match
        showSpinner();
        Games.RealTimeMultiplayer.create(mGoogleApiClient, roomConfigBuilder.build());
    }
}
 
Example 16
Source File: RealTimeMultiplayer.java    From godot-gpgs with MIT License 4 votes vote down vote up
/**
 * Intent Activity result parser
 * @param request The request of the Intent
 * @param response The response of the Intent
 * @param intent The Intent
 */
public void onActivityResult(int request, int response, Intent intent) {
    switch(request) {
        case RealTimeMultiplayer.RC_SELECT_PLAYERS:
            // Return if the user cancel
            if (response != Activity.RESULT_OK) return;

            // get the invitee list
            Bundle extras = intent.getExtras();
            final ArrayList<String> invitees = intent.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS);

            // Get auto-match criteria
            Bundle autoMatchCriteria = null;
            int minAutoMatchPlayers = intent.getIntExtra(Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0);
            int maxAutoMatchPlayers = intent.getIntExtra(Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0);

            if (minAutoMatchPlayers > 0) autoMatchCriteria = RoomConfig.createAutoMatchCriteria(minAutoMatchPlayers, maxAutoMatchPlayers, 0);
            else autoMatchCriteria = null;

            // Create the room and specify a variant if appropriate
            RoomConfig.Builder roomConfigBuilder = makeBasicRoomConfigBuilder();
            roomConfigBuilder.addPlayersToInvite(invitees);
            if (autoMatchCriteria != null) roomConfigBuilder.setAutoMatchCriteria(autoMatchCriteria);
            RoomConfig roomConfig = roomConfigBuilder.build();
            Games.RealTimeMultiplayer.create(googleApiClient, roomConfig);

            // Prevent screen from sleeping during handshake
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
            break;

        case RealTimeMultiplayer.RC_WAITING_ROOM:
            // we got the result from the "waiting room" UI.
            if (response == Activity.RESULT_OK) {
                // ready to start playing
                Log.d(TAG, "GPGS: Starting game (waiting room returned OK).");
                GodotLib.calldeferred(instanceId, "_on_gpgs_rtm_start_game", new Object[] { });
            } else if (response == GamesActivityResultCodes.RESULT_LEFT_ROOM) {
                // player indicated that they want to leave the room
                leaveRoom();
            } else if (response == Activity.RESULT_CANCELED) {
                // Dialog was cancelled (user pressed back key, for instance). In our game,
                // this means leaving the room too. In more elaborate games, this could mean
                // something else (like minimizing the waiting room UI).
                leaveRoom();
            }
            break;

        case RealTimeMultiplayer.RC_INVITATION_INBOX:
            // we got the result from the "select invitation" UI (invitation inbox). We're
            // ready to accept the selected invitation:
            handleInvitationInboxResult(response, intent);
            break;
    }
}
 
Example 17
Source File: MainActivity.java    From android-basic-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {

  if (requestCode == RC_SIGN_IN) {

    Task<GoogleSignInAccount> task =
        GoogleSignIn.getSignedInAccountFromIntent(intent);

    try {
      GoogleSignInAccount account = task.getResult(ApiException.class);
      onConnected(account);
    } catch (ApiException apiException) {
      String message = apiException.getMessage();
      if (message == null || message.isEmpty()) {
        message = getString(R.string.signin_other_error);
      }

      onDisconnected();

      new AlertDialog.Builder(this)
          .setMessage(message)
          .setNeutralButton(android.R.string.ok, null)
          .show();
    }
  } else if (requestCode == RC_SELECT_PLAYERS) {
    // we got the result from the "select players" UI -- ready to create the room
    handleSelectPlayersResult(resultCode, intent);

  } else if (requestCode == RC_INVITATION_INBOX) {
    // we got the result from the "select invitation" UI (invitation inbox). We're
    // ready to accept the selected invitation:
    handleInvitationInboxResult(resultCode, intent);

  } else if (requestCode == RC_WAITING_ROOM) {
    // we got the result from the "waiting room" UI.
    if (resultCode == Activity.RESULT_OK) {
      // ready to start playing
      Log.d(TAG, "Starting game (waiting room returned OK).");
      startGame(true);
    } else if (resultCode == GamesActivityResultCodes.RESULT_LEFT_ROOM) {
      // player indicated that they want to leave the room
      leaveRoom();
    } else if (resultCode == Activity.RESULT_CANCELED) {
      // Dialog was cancelled (user pressed back key, for instance). In our game,
      // this means leaving the room too. In more elaborate games, this could mean
      // something else (like minimizing the waiting room UI).
      leaveRoom();
    }
  }
  super.onActivityResult(requestCode, resultCode, intent);
}