Example #1
0
        public void onConsumeFinished(Purchase purchase, IabResult result) {
          Log.d(TAG, "Consumption finished. Purchase: " + purchase + ", result: " + result);

          // We know this is the "gas" sku because it's the only one we consume,
          // so we don't check which sku was consumed. If you have more than one
          // sku, you probably should check...
          if (result.isSuccess()) {
            // successfully consumed, so we apply the effects of the item in our
            // game world's logic, which in our case means filling the gas tank a bit
            Log.d(TAG, "Consumption successful. Provisioning.");
            mTank = mTank == TANK_MAX ? TANK_MAX : mTank + 1;
            saveData();
            alert("You filled 1/4 tank. Your tank is now " + String.valueOf(mTank) + "/4 full!");
          } else {
            complain("Error while consuming: " + result);
          }
          updateUi();
          setWaitScreen(false);
          Log.d(TAG, "End consumption flow.");
        }