Java Code Examples for com.google.android.gms.games.GamesActivityResultCodes#RESULT_RECONNECT_REQUIRED
The following examples show how to use
com.google.android.gms.games.GamesActivityResultCodes#RESULT_RECONNECT_REQUIRED .
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 ANE-Google-Play-Game-Services with Apache License 2.0 | 6 votes |
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 io2014-codelabs with Apache License 2.0 | 6 votes |
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 |
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 tedroid with Apache License 2.0 | 6 votes |
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 google-play-game-services-ane with MIT License | 6 votes |
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 |
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 FixMath with Apache License 2.0 | 6 votes |
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 dice-heroes with GNU General Public License v3.0 | 6 votes |
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 FlappyCow with MIT License | 6 votes |
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 10
Source File: GameServicesMultiplayer.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
/** * on main thread */ private void onFriendsSelected(int resultCode, Intent data) { if (resultCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { activity.getGameServicesHelper().onSignedOutFromOutside(); if (future != null) { Gdx.app.postRunnable(future); future = null; } return; } if (resultCode != Activity.RESULT_OK) { if (future != null) { Gdx.app.postRunnable(future); future = null; } return; } if (controller != null) { throw new IllegalStateException("tried to create new game, but there was already another!"); } final ArrayList<String> invitees = data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS); controller = createController(); Games.RealTimeMultiplayer.create( client, RoomConfig.builder(controller) .addPlayersToInvite(invitees) .setRoomStatusUpdateListener(controller) .setMessageReceivedListener(controller) .setVariant(variant) .build() ); }
Example 11
Source File: GameServicesHelper.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
public void onActivityResult(int requestCode, int resultCode, Intent data) { helper.onActivityResult(requestCode, resultCode, data); if (multiplayer != null) { multiplayer.onActivityResult(requestCode, resultCode, data); } if ((requestCode == GoogleAchievements.ACHIEVEMENTS_REQUEST_CODE || requestCode == LEADERBOARD_REQUEST_CODE) && resultCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { onSignedOutFromOutside(); } }
Example 12
Source File: GameHelper.java From dice-heroes with GNU General Public License v3.0 | 4 votes |
/** * Handle activity result. Call this method from your Activity's * onActivityResult callback. If the activity result pertains to the sign-in * process, processes it appropriately. */ public void onActivityResult(int requestCode, int responseCode, Intent intent) { debugLog("onActivityResult: req=" + (requestCode == RC_RESOLVE ? "RC_RESOLVE" : String .valueOf(requestCode)) + ", resp=" + GameHelperUtils.activityResponseCodeToString(responseCode)); if (requestCode != RC_RESOLVE) { debugLog("onActivityResult: request code not meant for us. Ignoring."); return; } // no longer expecting a resolution mExpectingResolution = false; if (!mConnecting) { debugLog("onActivityResult: ignoring because we are not connecting."); return; } // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (responseCode == Activity.RESULT_OK) { // Ready to try to connect again. debugLog("onAR: Resolution was RESULT_OK, so connecting current client again."); connect(); } else if (responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { debugLog("onAR: Resolution was RECONNECT_REQUIRED, so reconnecting."); connect(); } else if (responseCode == Activity.RESULT_CANCELED) { // User cancelled. debugLog("onAR: Got a cancellation result, so disconnecting."); mSignInCancelled = true; mConnectOnStart = false; mUserInitiatedSignIn = false; mSignInFailureReason = null; // cancelling is not a failure! mConnecting = false; mGoogleApiClient.disconnect(); // increment # of cancellations int prevCancellations = getSignInCancellations(); int newCancellations = incrementSignInCancellations(); debugLog("onAR: # of cancellations " + prevCancellations + " --> " + newCancellations + ", max " + mMaxAutoSignInAttempts); notifyListener(false); } else { // Whatever the problem we were trying to solve, it was not // solved. So give up and show an error message. debugLog("onAR: responseCode=" + GameHelperUtils .activityResponseCodeToString(responseCode) + ", so giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode(), responseCode)); } }
Example 13
Source File: GameHelper.java From FixMath with Apache License 2.0 | 4 votes |
/** * Handle activity result. Call this method from your Activity's * onActivityResult callback. If the activity result pertains to the sign-in * process, processes it appropriately. */ public void onActivityResult(int requestCode, int responseCode, Intent intent) { debugLog("onActivityResult: req=" + (requestCode == RC_RESOLVE ? "RC_RESOLVE" : String .valueOf(requestCode)) + ", resp=" + GameHelperUtils.activityResponseCodeToString(responseCode)); if (requestCode != RC_RESOLVE) { debugLog("onActivityResult: request code not meant for us. Ignoring."); return; } // no longer expecting a resolution mExpectingResolution = false; if (!mConnecting) { debugLog("onActivityResult: ignoring because we are not connecting."); return; } // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (responseCode == Activity.RESULT_OK) { // Ready to try to connect again. debugLog("onAR: Resolution was RESULT_OK, so connecting current client again."); connect(); } else if (responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { debugLog("onAR: Resolution was RECONNECT_REQUIRED, so reconnecting."); connect(); } else if (responseCode == Activity.RESULT_CANCELED) { // User cancelled. debugLog("onAR: Got a cancellation result, so disconnecting."); mSignInCancelled = true; mConnectOnStart = false; mUserInitiatedSignIn = false; mSignInFailureReason = null; // cancelling is not a failure! mConnecting = false; mGoogleApiClient.disconnect(); // increment # of cancellations int prevCancellations = getSignInCancellations(); int newCancellations = incrementSignInCancellations(); debugLog("onAR: # of cancellations " + prevCancellations + " --> " + newCancellations + ", max " + mMaxAutoSignInAttempts); notifyListener(false); } else { // Whatever the problem we were trying to solve, it was not // solved. So give up and show an error message. debugLog("onAR: responseCode=" + GameHelperUtils .activityResponseCodeToString(responseCode) + ", so giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode(), responseCode)); } }
Example 14
Source File: GameHelper.java From martianrun with Apache License 2.0 | 4 votes |
/** * Handle activity result. Call this method from your Activity's * onActivityResult callback. If the activity result pertains to the sign-in * process, processes it appropriately. */ public void onActivityResult(int requestCode, int responseCode, Intent intent) { debugLog("onActivityResult: req=" + (requestCode == RC_RESOLVE ? "RC_RESOLVE" : String .valueOf(requestCode)) + ", resp=" + GameHelperUtils.activityResponseCodeToString(responseCode)); if (requestCode != RC_RESOLVE) { debugLog("onActivityResult: request code not meant for us. Ignoring."); return; } // no longer expecting a resolution mExpectingResolution = false; if (!mConnecting) { debugLog("onActivityResult: ignoring because we are not connecting."); return; } // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (responseCode == Activity.RESULT_OK) { // Ready to try to connect again. debugLog("onAR: Resolution was RESULT_OK, so connecting current client again."); connect(); } else if (responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { debugLog("onAR: Resolution was RECONNECT_REQUIRED, so reconnecting."); connect(); } else if (responseCode == Activity.RESULT_CANCELED) { // User cancelled. debugLog("onAR: Got a cancellation result, so disconnecting."); mSignInCancelled = true; mConnectOnStart = false; mUserInitiatedSignIn = false; mSignInFailureReason = null; // cancelling is not a failure! mConnecting = false; mGoogleApiClient.disconnect(); // increment # of cancellations int prevCancellations = getSignInCancellations(); int newCancellations = incrementSignInCancellations(); debugLog("onAR: # of cancellations " + prevCancellations + " --> " + newCancellations + ", max " + mMaxAutoSignInAttempts); notifyListener(false); } else { // Whatever the problem we were trying to solve, it was not // solved. So give up and show an error message. debugLog("onAR: responseCode=" + GameHelperUtils .activityResponseCodeToString(responseCode) + ", so giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode(), responseCode)); } }
Example 15
Source File: GameHelper.java From google-play-game-services-ane with MIT License | 4 votes |
/** * Handle activity result. Call this method from your Activity's * onActivityResult callback. If the activity result pertains to the sign-in * process, processes it appropriately. */ public void onActivityResult(int requestCode, int responseCode, Intent intent) { debugLog("onActivityResult: req=" + (requestCode == RC_RESOLVE ? "RC_RESOLVE" : String.valueOf(requestCode)) + ", resp=" + GameHelperUtils.activityResponseCodeToString(responseCode)); if (requestCode != RC_RESOLVE) { debugLog("onActivityResult: request code not meant for us. Ignoring."); return; } // no longer expecting a resolution mExpectingResolution = false; if (!mConnecting) { debugLog("onActivityResult: ignoring because we are not connecting."); return; } // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (responseCode == Activity.RESULT_OK) { // Ready to try to connect again. debugLog("onAR: Resolution was RESULT_OK, so connecting current client again."); connect(); } else if (responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { debugLog("onAR: Resolution was RECONNECT_REQUIRED, so reconnecting."); connect(); } else if (responseCode == Activity.RESULT_CANCELED) { // User cancelled. debugLog("onAR: Got a cancellation result, so disconnecting."); mSignInCancelled = true; mConnectOnStart = false; mUserInitiatedSignIn = false; mSignInFailureReason = null; // cancelling is not a failure! mConnecting = false; mGoogleApiClient.disconnect(); // increment # of cancellations int prevCancellations = getSignInCancellations(); int newCancellations = incrementSignInCancellations(); debugLog("onAR: # of cancellations " + prevCancellations + " --> " + newCancellations + ", max " + mMaxAutoSignInAttempts); notifyListener(false); } else { // Whatever the problem we were trying to solve, it was not // solved. So give up and show an error message. debugLog("onAR: responseCode=" + GameHelperUtils.activityResponseCodeToString(responseCode) + ", so giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode(), responseCode)); } }
Example 16
Source File: GameHelper.java From cordova-google-play-games-services with MIT License | 4 votes |
/** * Handle activity result. Call this method from your Activity's * onActivityResult callback. If the activity result pertains to the sign-in * process, processes it appropriately. */ public void onActivityResult(int requestCode, int responseCode, Intent intent) { debugLog("onActivityResult: req=" + (requestCode == RC_RESOLVE ? "RC_RESOLVE" : String .valueOf(requestCode)) + ", resp=" + GameHelperUtils.activityResponseCodeToString(responseCode)); if (requestCode != RC_RESOLVE) { debugLog("onActivityResult: request code not meant for us. Ignoring."); return; } // no longer expecting a resolution mExpectingResolution = false; if (!mConnecting) { debugLog("onActivityResult: ignoring because we are not connecting."); return; } // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (responseCode == Activity.RESULT_OK) { // Ready to try to connect again. debugLog("onAR: Resolution was RESULT_OK, so connecting current client again."); connect(); } else if (responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { debugLog("onAR: Resolution was RECONNECT_REQUIRED, so reconnecting."); connect(); } else if (responseCode == Activity.RESULT_CANCELED) { // User cancelled. debugLog("onAR: Got a cancellation result, so disconnecting."); mSignInCancelled = true; mConnectOnStart = false; mUserInitiatedSignIn = false; mSignInFailureReason = null; // cancelling is not a failure! mConnecting = false; mGoogleApiClient.disconnect(); // increment # of cancellations int prevCancellations = getSignInCancellations(); int newCancellations = incrementSignInCancellations(); debugLog("onAR: # of cancellations " + prevCancellations + " --> " + newCancellations + ", max " + mMaxAutoSignInAttempts); notifyListener(false); } else { // Whatever the problem we were trying to solve, it was not // solved. So give up and show an error message. debugLog("onAR: responseCode=" + GameHelperUtils .activityResponseCodeToString(responseCode) + ", so giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode(), responseCode)); } }
Example 17
Source File: Main.java From chess with Apache License 2.0 | 4 votes |
@Override public void onActivityResult(int request, int response, final Intent data) { super.onActivityResult(request, response, data); if (BuildConfig.DEBUG) Logger.log("Main onActivityResult"); if (response == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED && !mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting()) { mGoogleApiClient.connect(); } else if (response == Activity.RESULT_CANCELED) { // User cancelled. mGoogleApiClient.disconnect(); } else if (response == Activity.RESULT_OK) { if (request == RC_SELECT_PLAYERS) { // get the invitee list final ArrayList<String> invitees = data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS); // get auto-match criteria Bundle autoMatchCriteria; int minAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0); int maxAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0); if (minAutoMatchPlayers > 0) { autoMatchCriteria = RoomConfig .createAutoMatchCriteria(minAutoMatchPlayers, maxAutoMatchPlayers, 0); } else { autoMatchCriteria = null; } TurnBasedMatchConfig tbmc = TurnBasedMatchConfig.builder().addInvitedPlayers(invitees) .setAutoMatchCriteria(autoMatchCriteria) .setVariant(StartFragment.LAST_SELECTED_MATCH_MODE).build(); // kick the match off Games.TurnBasedMultiplayer.createMatch(mGoogleApiClient, tbmc).setResultCallback( new ResultCallback<TurnBasedMultiplayer.InitiateMatchResult>() { @Override public void onResult(final TurnBasedMultiplayer.InitiateMatchResult result) { if (BuildConfig.DEBUG) Logger.log( "InitiateMatchResult onResult " + result.getStatus()); // Check if the status code is not success; if (result.getStatus().getStatusCode() != GamesStatusCodes.STATUS_OK) { return; } TurnBasedMatch match = result.getMatch(); if (match.getData() == null) { Game.newGame(new Match(match), mGoogleApiClient); } else { if (!Game.load(match.getData(), new Match(match), mGoogleApiClient)) { updateApp(); return; } } startGame(match.getMatchId()); } }); } else if (request == RC_RESOLVE) { // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (!mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting()) { // Ready to try to connect again. mGoogleApiClient.connect(); } } } }
Example 18
Source File: GameHelper.java From io2014-codelabs with Apache License 2.0 | 4 votes |
/** * Handle activity result. Call this method from your Activity's * onActivityResult callback. If the activity result pertains to the sign-in * process, processes it appropriately. */ public void onActivityResult(int requestCode, int responseCode, Intent intent) { debugLog("onActivityResult: req=" + (requestCode == RC_RESOLVE ? "RC_RESOLVE" : String .valueOf(requestCode)) + ", resp=" + GameHelperUtils.activityResponseCodeToString(responseCode)); if (requestCode != RC_RESOLVE) { debugLog("onActivityResult: request code not meant for us. Ignoring."); return; } // no longer expecting a resolution mExpectingResolution = false; if (!mConnecting) { debugLog("onActivityResult: ignoring because we are not connecting."); return; } // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (responseCode == Activity.RESULT_OK) { // Ready to try to connect again. debugLog("onAR: Resolution was RESULT_OK, so connecting current client again."); connect(); } else if (responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { debugLog("onAR: Resolution was RECONNECT_REQUIRED, so reconnecting."); connect(); } else if (responseCode == Activity.RESULT_CANCELED) { // User cancelled. debugLog("onAR: Got a cancellation result, so disconnecting."); mSignInCancelled = true; mConnectOnStart = false; mUserInitiatedSignIn = false; mSignInFailureReason = null; // cancelling is not a failure! mConnecting = false; mGoogleApiClient.disconnect(); // increment # of cancellations int prevCancellations = getSignInCancellations(); int newCancellations = incrementSignInCancellations(); debugLog("onAR: # of cancellations " + prevCancellations + " --> " + newCancellations + ", max " + mMaxAutoSignInAttempts); notifyListener(false); } else { // Whatever the problem we were trying to solve, it was not // solved. So give up and show an error message. debugLog("onAR: responseCode=" + GameHelperUtils .activityResponseCodeToString(responseCode) + ", so giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode(), responseCode)); } }
Example 19
Source File: GameHelper.java From Asteroid with Apache License 2.0 | 4 votes |
/** * Handle activity result. Call this method from your Activity's * onActivityResult callback. If the activity result pertains to the sign-in * process, processes it appropriately. */ public void onActivityResult(int requestCode, int responseCode, Intent intent) { debugLog("onActivityResult: req=" + (requestCode == RC_RESOLVE ? "RC_RESOLVE" : String .valueOf(requestCode)) + ", resp=" + GameHelperUtils.activityResponseCodeToString(responseCode)); if (requestCode != RC_RESOLVE) { debugLog("onActivityResult: request code not meant for us. Ignoring."); return; } // no longer expecting a resolution mExpectingResolution = false; if (!mConnecting) { debugLog("onActivityResult: ignoring because we are not connecting."); return; } // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (responseCode == AppCompatActivity.RESULT_OK) { // Ready to try to connect again. debugLog("onAR: Resolution was RESULT_OK, so connecting current client again."); connect(); } else if (responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { debugLog("onAR: Resolution was RECONNECT_REQUIRED, so reconnecting."); connect(); } else if (responseCode == AppCompatActivity.RESULT_CANCELED) { // User cancelled. debugLog("onAR: Got a cancellation result, so disconnecting."); mSignInCancelled = true; mConnectOnStart = false; mUserInitiatedSignIn = false; mSignInFailureReason = null; // cancelling is not a failure! mConnecting = false; mGoogleApiClient.disconnect(); // increment # of cancellations int prevCancellations = getSignInCancellations(); int newCancellations = incrementSignInCancellations(); debugLog("onAR: # of cancellations " + prevCancellations + " --> " + newCancellations + ", max " + mMaxAutoSignInAttempts); notifyListener(false); } else { // Whatever the problem we were trying to solve, it was not // solved. So give up and show an error message. debugLog("onAR: responseCode=" + GameHelperUtils .activityResponseCodeToString(responseCode) + ", so giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode(), responseCode)); } }
Example 20
Source File: GameHelper.java From io2014-codelabs with Apache License 2.0 | 4 votes |
/** * Handle activity result. Call this method from your Activity's * onActivityResult callback. If the activity result pertains to the sign-in * process, processes it appropriately. */ public void onActivityResult(int requestCode, int responseCode, Intent intent) { debugLog("onActivityResult: req=" + (requestCode == RC_RESOLVE ? "RC_RESOLVE" : String .valueOf(requestCode)) + ", resp=" + GameHelperUtils.activityResponseCodeToString(responseCode)); if (requestCode != RC_RESOLVE) { debugLog("onActivityResult: request code not meant for us. Ignoring."); return; } // no longer expecting a resolution mExpectingResolution = false; if (!mConnecting) { debugLog("onActivityResult: ignoring because we are not connecting."); return; } // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (responseCode == Activity.RESULT_OK) { // Ready to try to connect again. debugLog("onAR: Resolution was RESULT_OK, so connecting current client again."); connect(); } else if (responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) { debugLog("onAR: Resolution was RECONNECT_REQUIRED, so reconnecting."); connect(); } else if (responseCode == Activity.RESULT_CANCELED) { // User cancelled. debugLog("onAR: Got a cancellation result, so disconnecting."); mSignInCancelled = true; mConnectOnStart = false; mUserInitiatedSignIn = false; mSignInFailureReason = null; // cancelling is not a failure! mConnecting = false; mGoogleApiClient.disconnect(); // increment # of cancellations int prevCancellations = getSignInCancellations(); int newCancellations = incrementSignInCancellations(); debugLog("onAR: # of cancellations " + prevCancellations + " --> " + newCancellations + ", max " + mMaxAutoSignInAttempts); notifyListener(false); } else { // Whatever the problem we were trying to solve, it was not // solved. So give up and show an error message. debugLog("onAR: responseCode=" + GameHelperUtils .activityResponseCodeToString(responseCode) + ", so giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode(), responseCode)); } }