if (activity != null && pendingIntent != null) activity.startIntentSenderForResult(pendingIntent.getIntentSender(), PURCHASE_FLOW_REQUEST_CODE, new Intent(), 0, 0, 0);
@Override public void startForResult(@Nonnull IntentSender intentSender, int requestCode, @Nonnull Intent intent) throws IntentSender.SendIntentException { mActivity.startIntentSenderForResult(intentSender, requestCode, intent, 0, 0, 0); } };
@Override public void startIntentSenderForResult(IntentSender intentSender, int activityRequestCode, Intent intent, int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException { activity.startIntentSenderForResult(intentSender, activityRequestCode, intent, flagsMask, flagsValues, extraFlags); }
@Override public void startIntentSenderForResult(android.content.IntentSender intentsender0, int int1, android.content.Intent intent2, int int3, int int4, int int5) throws IntentSender.SendIntentException { mOriginActivity.startIntentSenderForResult(intentsender0, int1, intent2, int3, int4, int5); }
/** * @param intent * @param requestCode * @param fillInIntent * @param flagsMask * @param flagsValues * @param extraFlags * @throws SendIntentException * @see android.app.Activity#startIntentSenderForResult(android.content.IntentSender, * int, android.content.Intent, int, int, int) */ public void startIntentSenderForResult(IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws SendIntentException { mActivity.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags); }
/** * @param intent * @param requestCode * @param fillInIntent * @param flagsMask * @param flagsValues * @param extraFlags * @param options * @throws SendIntentException * @see android.app.Activity#startIntentSenderForResult(android.content.IntentSender, * int, android.content.Intent, int, int, int, android.os.Bundle) */ public void startIntentSenderForResult(IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws SendIntentException { mActivity.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options); }
mPurchaseListener = listener; mPurchasingItemType = itemType; act.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
@SuppressLint("RestrictedApi") @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public void startIntentSenderForResult(android.content.IntentSender intentsender0, int int1, android.content.Intent intent2, int int3, int int4, int int5, android.os.Bundle bundle6) throws IntentSender.SendIntentException { mOriginActivity.startIntentSenderForResult(intentsender0, int1, intent2, int3, int4, int5, bundle6); }
@Override public void startIntentSenderForResult (IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) { try { super.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options); } catch (IntentSender.SendIntentException e) { throw new ActivityNotFoundException(); } }
@Override public void startIntentSenderForResult (IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) { try { super.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options); } catch (IntentSender.SendIntentException e) { throw new ActivityNotFoundException(); } }
protected Void doInBackground(Void... params) { Log.d(LOG_TAG, "purchasePremiumTask: " + PREMIUM_SKU); Bundle buyIntentBundle; try { buyIntentBundle = billingService.getBuyIntent(3, context.getPackageName(), PREMIUM_SKU, ITEM_TYPE_INAPP, null); Log.d(LOG_TAG, "buyIntentBundle: " + buyIntentBundle); buyIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT); activity.startIntentSenderForResult(buyIntent.getIntentSender(), BILLING_REQ, new Intent(), 0, 0, 0); } catch(Exception e) { Log.e(LOG_TAG, "purchasePremiumTask failed: " + e.getMessage()); } return null; } }
protected void launchBilling(Context context, PendingIntent pendingIntent) { try { Tools.HangarLog("launchBilling!"); ((Activity) context).startIntentSenderForResult(pendingIntent.getIntentSender(), 1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0)); mAlert.cancel(); } catch (IntentSender.SendIntentException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Override public void startIntentSenderForResult (IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) { onStartForResult(requestCode); try { super.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options); } catch (IntentSender.SendIntentException e) { throw new ActivityNotFoundException(); } }
@Override public boolean purchase(@NonNull Activity activity, @NonNull String sku, int requestCode, @Nullable String payload) { try { final Bundle bundle = service.getBuyIntent(3, packageName, sku, BILLING_TYPE, payload); if (responseOk(bundle)) { final PendingIntent pendingIntent = bundle.getParcelable(RESPONSE_BUY_INTENT); if (pendingIntent != null) { final IntentSender sender = pendingIntent.getIntentSender(); activity.startIntentSenderForResult(sender, requestCode, null, 0, 0, 0); return true; } } } catch (RemoteException | IntentSender.SendIntentException ignore) { } return false; }
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()); } }
@Override public boolean startConfigActivity(Activity activity, int requestCode) { if (getUser().equals(Process.myUserHandle())) { return super.startConfigActivity(activity, requestCode); } try { Method m = LauncherApps.class.getDeclaredMethod( "getShortcutConfigActivityIntent", LauncherActivityInfo.class); IntentSender is = (IntentSender) m.invoke( activity.getSystemService(LauncherApps.class), mInfo); activity.startIntentSenderForResult(is, requestCode, null, 0, 0, 0); return true; } catch (Exception e) { e.printStackTrace(); return false; } } }
/** * Resolves an error by starting any intents requiring user interaction. See * {@link CommonStatusCodes#SIGN_IN_REQUIRED}, and {@link CommonStatusCodes#RESOLUTION_REQUIRED}. * * @param activity An Activity context to use to resolve the issue. The activity's * onActivityResult method will be invoked after the user is done. If the * resultCode is {@link Activity#RESULT_OK}, the application should try to * connect again. * @param requestCode The request code to pass to onActivityResult. * @throws SendIntentException If the resolution intent has been canceled or is no longer able * to execute the request. */ public void startResolutionForResult(Activity activity, int requestCode) throws SendIntentException { if (hasResolution()) { activity.startIntentSenderForResult(resolution.getIntentSender(), requestCode, null, 0, 0, 0); } }
/** * Resolves an error by starting any intents requiring user interaction. See * {@link #SIGN_IN_REQUIRED}, and {@link #RESOLUTION_REQUIRED}. * * @param activity An Activity context to use to resolve the issue. The activity's * {@link Activity#onActivityResult} method will be invoked after the user * is done. If the resultCode is {@link Activity#RESULT_OK}, the application * should try to connect again. * @param requestCode The request code to pass to {@link Activity#onActivityResult}. * @throws IntentSender.SendIntentException If the resolution intent has been canceled or is no * longer able to execute the request. */ public void startResolutionForResult(Activity activity, int requestCode) throws IntentSender.SendIntentException { if (hasResolution()) { activity.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, null, 0, 0, 0); } } }
@Test public void purchaseOk() throws Exception { final IInAppBillingService service = new SuccessfulBillingService(); final Activity activity = mock(Activity.class); final Billing billing = billing(service); final boolean response = billing.purchase(activity, SKU, 0, null); assertInvokedOnce(activity).startIntentSenderForResult(null, 0, null, 0, 0, 0); assertThat(response).isTrue(); }
bundle.putParcelable(Constants.RESPONSE_BUY_INTENT, pendingIntent); doThrow(new IntentSender.SendIntentException()).when(mActivity).startIntentSenderForResult( any(IntentSender.class), anyInt(), any(Intent.class), anyInt(), anyInt(), anyInt());