Java Code Examples for android.content.IntentSender#SendIntentException
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: MainActivity.java From journaldev with MIT License | 6 votes |
@Override public void onResult(@NonNull CredentialRequestResult credentialRequestResult) { Status status = credentialRequestResult.getStatus(); if (status.isSuccess()) { onCredentialRetrieved(credentialRequestResult.getCredential()); } else { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { isResolving = true; status.startResolutionForResult(this, RC_READ); } catch (IntentSender.SendIntentException e) { Log.d(TAG, e.toString()); } } else { showHintDialog(); } } }
Example 2
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException { try { String resolvedType = null; if (fillInIntent != null) { fillInIntent.setAllowFds(false); resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver()); } int result = ActivityManagerNative.getDefault() .startActivityIntentSender(mMainThread.getApplicationThread(), intent, fillInIntent, resolvedType, null, null, 0, flagsMask, flagsValues); if (result == IActivityManager.START_CANCELED) { throw new IntentSender.SendIntentException(); } Instrumentation.checkStartActivityResult(result, null); } catch (RemoteException e) { } }
Example 3
Source File: MainActivity.java From android-credentials with Apache License 2.0 | 6 votes |
/** * Called when the Load Hints button is clicked. Requests a Credential "hint" which will * be the basic profile information and an ID token for an account on the device. This is useful * to auto-fill sign-up forms with an email address, picture, and name or to do password-free * authentication with a server by providing an ID Token. */ private void loadHintClicked() { HintRequest hintRequest = new HintRequest.Builder() .setHintPickerConfig(new CredentialPickerConfig.Builder() .setShowCancelButton(true) .build()) .setIdTokenRequested(shouldRequestIdToken()) .setEmailAddressIdentifierSupported(true) .setAccountTypes(IdentityProviders.GOOGLE) .build(); ; PendingIntent intent = mCredentialsClient.getHintPickerIntent(hintRequest); try { startIntentSenderForResult(intent.getIntentSender(), RC_HINT, null, 0, 0, 0); mIsResolving = true; } catch (IntentSender.SendIntentException e) { Log.e(TAG, "Could not start hint picker Intent", e); mIsResolving = false; } }
Example 4
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws IntentSender.SendIntentException { try { String resolvedType = null; if (fillInIntent != null) { fillInIntent.migrateExtraStreamToClipData(); fillInIntent.prepareToLeaveProcess(this); resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver()); } int result = ActivityManager.getService() .startActivityIntentSender(mMainThread.getApplicationThread(), intent != null ? intent.getTarget() : null, intent != null ? intent.getWhitelistToken() : null, fillInIntent, resolvedType, null, null, 0, flagsMask, flagsValues, options); if (result == ActivityManager.START_CANCELED) { throw new IntentSender.SendIntentException(); } Instrumentation.checkStartActivityResult(result, null); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example 5
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws IntentSender.SendIntentException { try { String resolvedType = null; if (fillInIntent != null) { fillInIntent.setAllowFds(false); resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver()); } int result = ActivityManagerNative.getDefault() .startActivityIntentSender(mMainThread.getApplicationThread(), intent, fillInIntent, resolvedType, null, null, 0, flagsMask, flagsValues, options); if (result == ActivityManager.START_CANCELED) { throw new IntentSender.SendIntentException(); } Instrumentation.checkStartActivityResult(result, null); } catch (RemoteException e) { } }
Example 6
Source File: LocationAlarmActivity.java From LocationAware with Apache License 2.0 | 5 votes |
@Override public void startResolutionForLocation(ResolvableApiException resolvable) { try { resolvable.startResolutionForResult((Activity) context, REQUEST_CHECK_SETTINGS); } catch (IntentSender.SendIntentException e) { e.printStackTrace(); } }
Example 7
Source File: MapsActivity.java From vocefiscal-android with Apache License 2.0 | 5 votes |
@Override public void onConnectionFailed(ConnectionResult connectionResult) { /* * Google Play services can resolve some errors it detects. * If the error has a resolution, try sending an Intent to * start a Google Play services activity that can resolve * error. */ if (connectionResult.hasResolution()) { try { // Start an Activity that tries to resolve the error connectionResult.startResolutionForResult(this, LocationUtils.CONNECTION_FAILURE_RESOLUTION_REQUEST); /* * Thrown if Google Play services canceled the original * PendingIntent */ } catch (IntentSender.SendIntentException e) { // Log the error } } else { // If no resolution is available, display a dialog to the user with the error. //Log.e(LocationUtils.APPTAG, String.valueOf(connectionResult.getErrorCode())); } }
Example 8
Source File: DriveFragment.java From amiibo with GNU General Public License v2.0 | 5 votes |
@DebugLog @Override public void onConnectionFailed(ConnectionResult connectionResult) { if (connectionResult.hasResolution()) { try { connectionResult.startResolutionForResult(getActivity(), RESOLVE_CONNECTION_REQUEST_CODE); } catch (IntentSender.SendIntentException e) { // Unable to resolve, message user appropriately } } else { GooglePlayServicesUtil .getErrorDialog(connectionResult.getErrorCode(), getActivity(), 0).show(); } }
Example 9
Source File: UpdateManager.java From InAppUpdater with MIT License | 5 votes |
private void startUpdate(AppUpdateInfo appUpdateInfo) { try { Log.d(TAG, "Starting update"); appUpdateManager.startUpdateFlowForResult( appUpdateInfo, mode, getActivity(), UpdateManagerConstant.REQUEST_CODE); } catch (IntentSender.SendIntentException e) { Log.d(TAG, "" + e.getMessage()); } }
Example 10
Source File: InAppBillingV3VendorTest.java From Cashier with Apache License 2.0 | 5 votes |
@Test public void purchaseFailsIfResponseCodeIsInvalid() throws RemoteException, IntentSender.SendIntentException, JSONException { mockDependeniesForSuccessfulPurchaseFlow(); InAppBillingV3Vendor vendor = new InAppBillingV3Vendor(api, null); vendor.initialize(mock(Context.class), initializationListener); Product inappPurchase = Product .create( InAppBillingConstants.VENDOR_PACKAGE, "so.product.much.purchase", "1", "1", "1", "1", false, 1); PurchaseListener purchaseListener = mock(PurchaseListener.class); vendor.purchase(activity, inappPurchase, null, purchaseListener); Intent intent = new Intent() .putExtra(RESPONSE_CODE, BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE) .putExtra(RESPONSE_INAPP_PURCHASE_DATA, VALID_PURCHASE_RECEIPT_JSON) .putExtra(RESPONSE_INAPP_SIGNATURE, ""); vendor.onActivityResult( vendor.getRequestCode(), Activity.RESULT_OK, intent); verify(purchaseListener, times(1)).failure(inappPurchase, new Vendor.Error(PURCHASE_UNAVAILABLE, BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE)); }
Example 11
Source File: PurchaseFlowLauncher.java From android-easy-checkout with Apache License 2.0 | 5 votes |
private void startBuyIntent(final Activity activity, final PendingIntent pendingIntent, int requestCode) throws BillingException { IntentSender sender = pendingIntent.getIntentSender(); try { activity.startIntentSenderForResult(sender, requestCode, new Intent(), 0, 0, 0); } catch (IntentSender.SendIntentException e) { throw new BillingException(Constants.ERROR_SEND_INTENT_FAILED, e.getMessage()); } }
Example 12
Source File: LoginActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
@Override public void onConnectionFailed(@NonNull ConnectionResult result) { if (result.hasResolution()) { try { result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR); } catch (IntentSender.SendIntentException ignore) { // The intent was canceled before it was sent. } } }
Example 13
Source File: MapsActivity.java From android-location-example with MIT License | 5 votes |
@Override public void onConnectionFailed(ConnectionResult connectionResult) { /* * Google Play services can resolve some errors it detects. * If the error has a resolution, try sending an Intent to * start a Google Play services activity that can resolve * error. */ if (connectionResult.hasResolution()) { try { // Start an Activity that tries to resolve the error connectionResult.startResolutionForResult(this, CONNECTION_FAILURE_RESOLUTION_REQUEST); /* * Thrown if Google Play services canceled the original * PendingIntent */ } catch (IntentSender.SendIntentException e) { // Log the error e.printStackTrace(); } } else { /* * If no resolution is available, display a dialog to the * user with the error. */ Log.i(TAG, "Location services connection failed with code " + connectionResult.getErrorCode()); } }
Example 14
Source File: MainActivity.java From AndroidDemoProjects with Apache License 2.0 | 5 votes |
@Override public void onConnectionFailed(ConnectionResult connectionResult) { if( !authInProgress ) { try { authInProgress = true; connectionResult.startResolutionForResult( MainActivity.this, REQUEST_OAUTH ); } catch(IntentSender.SendIntentException e ) { Log.e( "GoogleFit", "sendingIntentException " + e.getMessage() ); } } else { Log.e( "GoogleFit", "authInProgress" ); } }
Example 15
Source File: GpgEncryptionParamsFragment.java From oversec with GNU General Public License v3.0 | 5 votes |
public void triggerRecipientSelection(int requestCode, Intent actionIntent) { PendingIntent pi = getGpgEncryptionHandler(getMView().getContext()).triggerRecipientSelection(actionIntent); if (pi != null) { try { getActivity().startIntentSenderForResult(pi.getIntentSender(), requestCode, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { e.printStackTrace(); //TODO now what? } } else { //TODO really needed? recipientsSelectedCallback.onRecipientsSelected(null); } }
Example 16
Source File: MainActivity.java From io2015-codelabs with Apache License 2.0 | 5 votes |
private void resolveSignInError() { if (mSignInIntent != null) { try { mSignInProgress = STATE_IN_PROGRESS; startIntentSenderForResult(mSignInIntent.getIntentSender(), RC_SIGN_IN, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { mSignInProgress = STATE_SIGNING_IN; mGoogleApiClient.connect(); } } else { // You have a Play Services error -- inform the user } }
Example 17
Source File: InAppBillingV3VendorTest.java From Cashier with Apache License 2.0 | 5 votes |
@Test public void purchaseFailsIfSignatureIsInvalid() throws RemoteException, IntentSender.SendIntentException { mockDependeniesForSuccessfulPurchaseFlow(); InAppBillingV3Vendor vendor = new InAppBillingV3Vendor(api, TEST_PUBLIC_KEY); vendor.initialize(mock(Context.class), initializationListener); Product inappPurchase = Product .create( InAppBillingConstants.VENDOR_PACKAGE, "so.product.much.purchase", "1", "1", "1", "1", false, 1); PurchaseListener purchaseListener = mock(PurchaseListener.class); vendor.purchase(activity, inappPurchase, "hello-cashier!", purchaseListener); vendor.onActivityResult( vendor.getRequestCode(), Activity.RESULT_OK, new Intent() .putExtra(RESPONSE_CODE, BILLING_RESPONSE_RESULT_OK) .putExtra(RESPONSE_INAPP_PURCHASE_DATA, VALID_PURCHASE_RECEIPT_JSON) .putExtra(RESPONSE_INAPP_SIGNATURE, TEST_INVALID_PUBLIC_KEY)); verify(purchaseListener, times(1)).failure(inappPurchase, new Vendor.Error(PURCHASE_SUCCESS_RESULT_MALFORMED, BILLING_RESPONSE_RESULT_ERROR)); }
Example 18
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException { startIntentSender(intent, fillInIntent, flagsMask, flagsValues, extraFlags, null); }
Example 19
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException { startIntentSender(intent, fillInIntent, flagsMask, flagsValues, extraFlags, null); }
Example 20
Source File: InternalContextWrapper.java From flowless with Apache License 2.0 | 4 votes |
@TargetApi(16) @Override public void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws IntentSender.SendIntentException { activity.startIntentSender(intent, fillInIntent, flagsMask, flagsValues, extraFlags, options); }