Example #1
0
        public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
          Log.d(TAG, "Query inventory finished.");

          if (result.isFailure()) {
            complain("Failed to query inventory: " + result);
            return;
          }

          Log.d(TAG, "Query inventory was successful.");
          // query the locally cached inventory Clear purchases
          mHelper.queryInventoryAsync(localInventoryListener);

          ShoppingItems = new ArrayList<SkuDetails>();

          SkuDetails onemonth = inventory.getSkuDetails(Onemonth);
          ShoppingItems.add(onemonth);

          SkuDetails threemonths = inventory.getSkuDetails(Threemonths);
          ShoppingItems.add(threemonths);

          SkuDetails sixmonths = inventory.getSkuDetails(Sixmonths);
          ShoppingItems.add(sixmonths);

          SkuDetails ninemonths = inventory.getSkuDetails(Ninemonths);
          ShoppingItems.add(ninemonths);

          SkuDetails twelvemonths = inventory.getSkuDetails(Twelvemonths);
          ShoppingItems.add(twelvemonths);

          loadAdapter();
        }
Example #2
0
        public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

          if (result.isFailure()) {
            // handle error here
          } else {
            // does the user have the premium upgrade?

            boolean IhavePurchase = inventory.hasPurchase(Onemonth);
            if (IhavePurchase) {

              mHelper.consumeAsync(inventory.getPurchase(Onemonth), mConsumeFinishedListener);
            }
          }
        }