public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

          mHelper.flagEndAsync();

          if (result.isFailure()) {
            updateListener.updateFailed();
            return;
          }

          for (StoreItem item : getAllStoreItems(c)) {
            if (item.googleSKU != null) {
              item.isPurchased = inventory.hasPurchase(item.googleSKU);
            }
          }

          writePurchasedItems(c);

          updateListener.updateSuccess();
        }
        public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
          StoreItem purchasedItem = null;
          int index = 0;

          mHelper.flagEndAsync();

          if (purchase == null) {
            Toast.makeText(
                    c,
                    "We can't find the requested item. Please try again soon!",
                    Toast.LENGTH_SHORT)
                .show();
            return;
          }

          for (StoreItem item : getAllStoreItems(c)) {
            if (item.googleSKU.compareTo(purchase.getSku()) == 0) {
              purchasedItem = item;
              break;
            }

            index++;
          }

          if (result.isFailure() || purchasedItem == null) {
            Log.d("FF PURCHASE", "Error purchasing: " + result);
            purchaseListener.purchaseFailed(purchasedItem, purchase);
            return;
          } else {
            purchasedItem.isPurchased = true;
            getAllStoreItems(c).get(index).isPurchased = true;
            purchaseListener.purchaseSuccess(purchasedItem, purchase);
          }

          writePurchasedItems(c);
        }