bundle = billingService.getBuyIntentToReplaceSkus(Constants.GOOGLE_API_SUBSCRIPTION_CHANGE_VERSION, contextPackageName, oldProductIds,
@Override void start(@Nonnull IInAppBillingService service, @Nonnull String packageName) throws RemoteException, RequestException { final Bundle bundle = service.getBuyIntentToReplaceSkus(mApiVersion, packageName, mOldSkus, mNewSku, mProduct, mPayload == null ? "" : mPayload); if (handleError(bundle)) { return; } final PendingIntent pendingIntent = bundle.getParcelable("BUY_INTENT"); Check.isNotNull(pendingIntent); onSuccess(pendingIntent); }
return; buyIntentBundle = mService.getBuyIntentToReplaceSkus(5, mContext.getPackageName(), oldSkus, sku, itemType, extraData);
private Bundle getBuyIntent(IInAppBillingService service, List<String> oldItemIds, String itemId, String developerPayload) throws BillingException { try { // Purchase an item if (oldItemIds == null || oldItemIds.isEmpty()) { return service.getBuyIntent( mApiVersion, mPackageName, itemId, mItemType, developerPayload); } // Upgrade/downgrade of subscriptions must be done on api version 5 // See https://developer.android.com/google/play/billing/billing_reference.html#upgrade-getBuyIntentToReplaceSkus return service.getBuyIntentToReplaceSkus( BillingApi.VERSION_5.getValue(), mPackageName, oldItemIds, itemId, mItemType, developerPayload); } catch (RemoteException e) { throw new BillingException(Constants.ERROR_REMOTE_EXCEPTION, e.getMessage()); } }
oldSkus.add("test"); when(mService.getBuyIntentToReplaceSkus( BillingApi.VERSION_5.getValue(), mBillingContext.getContext().getPackageName(), assertThat(e.getMessage()).isEqualTo(Constants.ERROR_MSG_PENDING_INTENT); } finally { verify(mService).getBuyIntentToReplaceSkus( BillingApi.VERSION_5.getValue(), mBillingContext.getContext().getPackageName(),