android.content.IntentSender.SendIntentException Java Examples
The following examples show how to use
android.content.IntentSender.SendIntentException.
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: PackageInstallerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override public void onPackageDeleted(String basePackageName, int returnCode, String msg) { if (PackageManager.DELETE_SUCCEEDED == returnCode && mNotification != null) { NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(basePackageName, SystemMessage.NOTE_PACKAGE_STATE, mNotification); } final Intent fillIn = new Intent(); fillIn.putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, mPackageName); fillIn.putExtra(PackageInstaller.EXTRA_STATUS, PackageManager.deleteStatusToPublicStatus(returnCode)); fillIn.putExtra(PackageInstaller.EXTRA_STATUS_MESSAGE, PackageManager.deleteStatusToString(returnCode, msg)); fillIn.putExtra(PackageInstaller.EXTRA_LEGACY_STATUS, returnCode); try { mTarget.sendIntent(mContext, 0, fillIn, null, null); } catch (SendIntentException ignored) { } }
Example #2
Source File: LoginActivity.java From zulip-android with Apache License 2.0 | 6 votes |
@Override public void onConnectionFailed(ConnectionResult result) { if (commonProgressDialog.isShowing()) { // The user clicked the sign-in button already. Start to resolve // connection errors. Wait until onConnected() to dismiss the // connection dialog. if (result.hasResolution()) { try { result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR); } catch (SendIntentException e) { Log.e(TAG, e.getMessage(), e); // Yeah, no idea what to do here. commonProgressDialog.dismiss(); Toast.makeText(LoginActivity.this, R.string.google_app_login_failed, Toast.LENGTH_SHORT).show(); } } else { commonProgressDialog.dismiss(); if (!isNetworkAvailable()) { Toast.makeText(LoginActivity.this, R.string.toast_no_internet_connection, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(LoginActivity.this, R.string.google_app_login_failed, Toast.LENGTH_SHORT).show(); } } } }
Example #3
Source File: ConversationFragment.java From Pix-Art-Messenger with GNU General Public License v3.0 | 6 votes |
@Override public void onClick(View v) { PendingIntent pendingIntent = conversation.getAccount().getPgpDecryptionService().getPendingIntent(); if (pendingIntent != null) { try { getActivity().startIntentSenderForResult(pendingIntent.getIntentSender(), REQUEST_DECRYPT_PGP, null, 0, 0, 0); } catch (SendIntentException e) { ToastCompat.makeText(getActivity(), R.string.unable_to_connect_to_keychain, Toast.LENGTH_SHORT).show(); conversation.getAccount().getPgpDecryptionService().continueDecryption(true); } } updateSnackBar(conversation); }
Example #4
Source File: ActivityWindowAndroid.java From 365browser with Apache License 2.0 | 6 votes |
@Override public int showCancelableIntent( PendingIntent intent, IntentCallback callback, Integer errorId) { Activity activity = getActivity().get(); if (activity == null) return START_INTENT_FAILURE; int requestCode = generateNextRequestCode(); try { activity.startIntentSenderForResult( intent.getIntentSender(), requestCode, new Intent(), 0, 0, 0); } catch (SendIntentException e) { return START_INTENT_FAILURE; } storeCallbackData(requestCode, callback, errorId); return requestCode; }
Example #5
Source File: GooglePlusManager.java From barterli_android with Apache License 2.0 | 6 votes |
/** * A helper method to flip the mResolveOnFail flag and start the resolution * of the ConnenctionResult from the failed connect() call. */ private void startResolution() { try { // Don't start another resolution now until we have a // result from the activity we're about to start. mResolveOnFail = false; // If we can resolve the error, then call start resolution // and pass it an integer tag we can use to track. This means // that when we get the onActivityResult callback we'll know // its from being started here. mConnectionResult .startResolutionForResult(mActivity, CONNECTION_UPDATE_ERROR); } catch (final SendIntentException e) { // Any problems, just try to connect() again so we get a new // ConnectionResult. mPlusClient.connect(); } }
Example #6
Source File: Client.java From godot-gpgs with MIT License | 6 votes |
public boolean resolveConnectionFailure(ConnectionResult result, int requestCode) { if (result.hasResolution()) { try { result.startResolutionForResult(activity, requestCode); return true; } catch (IntentSender.SendIntentException e) { // The intent was canceled before it was sent. Return to the default // state and attempt to connect to get an updated ConnectionResult. googleApiClient.connect(); return false; } } else { // not resolvable... so show an error message int errorCode = result.getErrorCode(); if (errorCode == ConnectionResult.INTERNAL_ERROR) { googleApiClient.connect(); } GodotLib.calldeferred(instance_id, "_on_google_play_game_services_connection_failed", new Object[] { }); Log.i(TAG, "GPGS: onConnectionFailed error code: " + String.valueOf(errorCode)); return false; } }
Example #7
Source File: LoginActivity.java From aws-mobile-self-paced-labs-samples with Apache License 2.0 | 6 votes |
private void resolveSignInError() { if (connectionResult.hasResolution()) { try { intentInProgress = true; startIntentSenderForResult(connectionResult.getResolution() .getIntentSender(), RC_SIGN_IN, null, 0, 0, 0); } catch (SendIntentException e) { Log.i(LOG_TAG, "Sign in intent could not be sent: " + e.getLocalizedMessage()); // The intent was canceled before it was sent. Return to the // default // state and attempt to connect to get an updated // ConnectionResult. intentInProgress = false; googleAPIClient.connect(); } } }
Example #8
Source File: ConversationFragment.java From Conversations with GNU General Public License v3.0 | 6 votes |
@Override public void onClick(View v) { PendingIntent pendingIntent = conversation.getAccount().getPgpDecryptionService().getPendingIntent(); if (pendingIntent != null) { try { getActivity().startIntentSenderForResult(pendingIntent.getIntentSender(), REQUEST_DECRYPT_PGP, null, 0, 0, 0); } catch (SendIntentException e) { Toast.makeText(getActivity(), R.string.unable_to_connect_to_keychain, Toast.LENGTH_SHORT).show(); conversation.getAccount().getPgpDecryptionService().continueDecryption(true); } } updateSnackBar(conversation); }
Example #9
Source File: GoogleImpl.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void onConnectionFailed(final ConnectionResult cr) { if (AndroidNativeUtil.getActivity() == null) { return; } final CodenameOneActivity main = (CodenameOneActivity) AndroidNativeUtil.getActivity(); if (!mIntentInProgress && cr.hasResolution()) { try { mIntentInProgress = true; main.startIntentSenderForResult(cr.getResolution().getIntentSender(), 0, null, 0, 0, 0); main.setIntentResultListener(new com.codename1.impl.android.IntentResultListener() { public void onActivityResult(int requestCode, int resultCode, android.content.Intent data) { mIntentInProgress = false; if (!mGoogleApiClient.isConnecting()) { mGoogleApiClient.connect(); } main.restoreIntentResultListener(); } }); } catch (SendIntentException e) { // The intent was canceled before it was sent. Return to the default // state and attempt to connect to get an updated ConnectionResult. mIntentInProgress = false; mGoogleApiClient.connect(); } return; } if (callback != null) { Display.getInstance().callSerially(new Runnable() { @Override public void run() { callback.loginFailed(GooglePlayServicesUtil.getErrorString(cr.getErrorCode())); } }); } }
Example #10
Source File: CompanionActivity.java From robocar with Apache License 2.0 | 5 votes |
@Override public void onGoogleApiConnectionFailed(ConnectionResult connectionResult) { if (connectionResult.hasResolution()) { try { connectionResult.startResolutionForResult(this, REQUEST_RESOLVE_CONNECTION); } catch (SendIntentException e) { Log.e(TAG, "Google API connection failed. " + connectionResult, e); } } else { Log.e(TAG, "Google API connection failed. " + connectionResult); } }
Example #11
Source File: BlueprintActivity.java From CompositeAndroid with Apache License 2.0 | 5 votes |
/** * Same as calling {@link #startIntentSenderFromChild(Activity, IntentSender, * int, Intent, int, int, int, Bundle)} with no options. */ @Override public void startIntentSenderFromChild(Activity child, IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws SendIntentException { super.startIntentSenderFromChild(child, intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags); }
Example #12
Source File: GameHelper.java From FixMath with Apache License 2.0 | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } if (mActivity == null) { debugLog("No need to resolve issue, activity does not exist anymore"); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); mConnectionResult = null; } }
Example #13
Source File: GameHelper.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } if (mActivity == null) { debugLog("No need to resolve issue, activity does not exist anymore"); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }
Example #14
Source File: CompositeFragment.java From CompositeAndroid with Apache License 2.0 | 5 votes |
@Override public void startIntentSenderForResult(IntentSender intent, int requestCode, @Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws SendIntentException { try { delegate.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options); } catch (SuppressedException e) { throw (SendIntentException) e.getCause(); } }
Example #15
Source File: CompositeDialogFragment.java From CompositeAndroid with Apache License 2.0 | 5 votes |
@Override public void startIntentSenderForResult(IntentSender intent, int requestCode, @Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws SendIntentException { try { delegate.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options); } catch (SuppressedException e) { throw (SendIntentException) e.getCause(); } }
Example #16
Source File: GameHelper.java From ANE-Google-Play-Game-Services with Apache License 2.0 | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }
Example #17
Source File: MainActivity.java From cloud-cup-android with Apache License 2.0 | 5 votes |
public void onConnectionFailed(ConnectionResult result) { if (!mIntentInProgress && result.hasResolution()) { try { mIntentInProgress = true; startIntentSenderForResult(result.getResolution().getIntentSender(), RC_SIGN_IN, null, 0, 0, 0); } catch (SendIntentException e) { // The intent was canceled before it was sent. Return to the default // state and attempt to connect to get an updated ConnectionResult. mIntentInProgress = false; mGoogleApiClient.connect(); } } }
Example #18
Source File: PackageInstallerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void onUserActionRequired(Intent intent) { final Intent fillIn = new Intent(); fillIn.putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, mPackageName); fillIn.putExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_PENDING_USER_ACTION); fillIn.putExtra(Intent.EXTRA_INTENT, intent); try { mTarget.sendIntent(mContext, 0, fillIn, null, null); } catch (SendIntentException ignored) { } }
Example #19
Source File: MainActivity.java From ListViewAnimations with Apache License 2.0 | 5 votes |
private void buy(final String sku) { try { Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(), sku, "inapp", "bGoa+V7g/ysDXvKwqq+JTFn4uQZbPiQJo4pf9RzJ"); PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT"); if (pendingIntent != null) { startIntentSenderForResult(pendingIntent.getIntentSender(), 1001, new Intent(), 0, 0, 0); } } catch (RemoteException | SendIntentException ignored) { Toast.makeText(this, getString(R.string.exception), Toast.LENGTH_LONG).show(); } }
Example #20
Source File: PromoAddressLookupFragment.java From androidpay-quickstart with Apache License 2.0 | 5 votes |
private void resolveConnection() { try { if (mConnectionResult != null && mConnectionResult.hasResolution()) { mConnectionResult.startResolutionForResult(getActivity(), REQUEST_CODE_RESOLVE_ERR); } else { mGoogleApiClient.connect(); } } catch (SendIntentException e) { mConnectionResult = null; mGoogleApiClient.connect(); } }
Example #21
Source File: GameHelper.java From FlappyCow with MIT License | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } if (mActivity == null) { debugLog("No need to resolve issue, activity does not exist anymore"); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); mConnectionResult = null; } }
Example #22
Source File: GameHelper.java From martianrun with Apache License 2.0 | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }
Example #23
Source File: GameHelper.java From google-play-game-services-ane with MIT License | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }
Example #24
Source File: GameHelper.java From cordova-google-play-games-services with MIT License | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }
Example #25
Source File: GameHelper.java From ColorPhun with Apache License 2.0 | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }
Example #26
Source File: MainActivity.java From android-google-accounts with Apache License 2.0 | 5 votes |
/** * Starts an appropriate intent or dialog for user interaction to resolve the current error * preventing the user from being signed in. This could be a dialog allowing the user to * select an account, an activity allowing the user to consent to the permissions being * requested by your app, a setting to enable device networking, etc. */ protected void resolveSignInError() { if (mSignInIntent != null) { // We have an intent which will allow our user to sign in or resolve an error. For // example if the user needs to select an account to sign in with, // or if they need to consent to the permissions your app is requesting. try { // Send the pending intent that we stored on the most recent OnConnectionFailed // callback. This will allow the user to resolve the error currently preventing // our connection to Google Play Services. mSignInProgress = STATE_IN_PROGRESS; startIntentSenderForResult(mSignInIntent.getIntentSender(), RC_SIGN_IN, null, 0, 0, 0); } catch (SendIntentException e) { Log.i(TAG, "Sign in intent could not be sent: " + e.getLocalizedMessage()); // The intent was canceled before it was sent. Attempt to // connect to get an updated ConnectionResult. mSignInProgress = STATE_SIGN_IN; mGoogleApiClient.connect(); } } else { // Google Play Services wasn't able to provide an intent for some error types, // so we show the default Google Play services error dialog which may still start an // intent on our behalf if the user can resolve the issue. showDialog(DIALOG_PLAY_SERVICES_ERROR); } }
Example #27
Source File: GameHelper.java From io2014-codelabs with Apache License 2.0 | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }
Example #28
Source File: GameHelper.java From io2014-codelabs with Apache License 2.0 | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }
Example #29
Source File: GameHelper.java From Onesearch with MIT License | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } if (mActivity == null) { debugLog("No need to resolve issue, activity does not exist anymore"); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }
Example #30
Source File: GameHelper.java From tedroid with Apache License 2.0 | 5 votes |
/** * Attempts to resolve a connection failure. This will usually involve * starting a UI flow that lets the user give the appropriate consents * necessary for sign-in to work. */ void resolveConnectionResult() { // Try to resolve the problem if (mExpectingResolution) { debugLog("We're already expecting the result of a previous resolution."); return; } debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult); if (mConnectionResult.hasResolution()) { // This problem can be fixed. So let's try to fix it. debugLog("Result has resolution. Starting it."); try { // launch appropriate UI flow (which might, for example, be the // sign-in flow) mExpectingResolution = true; mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE); } catch (SendIntentException e) { // Try connecting again debugLog("SendIntentException, so connecting again."); connect(); } } else { // It's not a problem what we can solve, so give up and show an // error. debugLog("resolveConnectionResult: result has no resolution. Giving up."); giveUp(new SignInFailureReason(mConnectionResult.getErrorCode())); } }