private void getPurchaseIdsByType(List<String> inAppPurchasesIds, List<String> subsPurchasesIds) { for (int i = 0; i < purchaseManagerConfig.getOfferCount(); i++) { Offer offer = purchaseManagerConfig.getOffer(i); if (offer.getType().equals(OfferType.SUBSCRIPTION)) subsPurchasesIds.add(offer.getIdentifier()); else inAppPurchasesIds.add(offer.getIdentifier()); } }
@Override public void install (final PurchaseObserver observer, PurchaseManagerConfig config, boolean autoFetchInformation) { this.observer = observer; this.config = config; // --- copy all available products to the list of productIdentifiers int offerSize = config.getOfferCount(); productIdentifiers = new HashSet<>(offerSize); for (int z = 0; z < config.getOfferCount(); z++) { productIdentifiers.add(config.getOffer(z).getIdentifierForStore(storeName())); } PurchasingService.registerListener(activity.getApplicationContext(), this); // PurchasingService.IS_SANDBOX_MODE returns a boolean value. // Use this boolean value to check whether your app is running in test mode under the App Tester // or in the live production environment. Gdx.app.log(TAG, "Amazon IAP: sandbox mode is:" + PurchasingService.IS_SANDBOX_MODE); PurchasingService.getUserData(); if (autoFetchInformation) PurchasingService.getProductData(productIdentifiers); else productDataRetrieved = true; }
private void fetchOfferDetails() { int offerSize = config.getOfferCount(); List<String> skuList = new ArrayList<>(offerSize); for (int z = 0; z < config.getOfferCount(); z++) { skuList.add(config.getOffer(z).getIdentifierForStore(storeName()));
/** * @param autoFetchInformation is not used, because without product information on ios it's not possible to fill * {@link Transaction} object on successful purchase **/ @Override public void install (PurchaseObserver observer, PurchaseManagerConfig config, boolean autoFetchInformation) { this.observer = observer; this.config = config; log(LOGTYPELOG, "Installing purchase observer..."); // Check if the device is configured for purchases. if (SKPaymentQueue.canMakePayments()) { // Create string set from offer identifiers. int size = config.getOfferCount(); Set<String> productIdentifiers = new HashSet<String>(size); for (int i = 0; i < size; i++) { productIdentifiers.add(config.getOffer(i).getIdentifierForStore(PurchaseManagerConfig.STORE_NAME_IOS_APPLE)); } // Request configured offers/products. log(LOGTYPELOG, "Requesting products..."); productsRequest = new SKProductsRequest(productIdentifiers); productsRequest.setDelegate(new IosFetchProductsAndInstallDelegate()); productsRequest.start(); } else { log(LOGTYPEERROR, "Error setting up in-app-billing: Device not configured for purchases!"); observer.handleInstallError(new RuntimeException( "Error installing purchase observer: Device not configured for purchases!")); } }
int size = config.getOfferCount(); NSMutableSet<String> productIdentifiers = (NSMutableSet<String>) NSMutableSet.alloc() .initWithCapacity(size);