@Override public void onPurchasesUpdated(int responseCode, @Nullable List<Purchase> purchases) { // check the edge case that the callback comes with a delay right after dispose() was called if (observer == null) return; if (responseCode == BillingClient.BillingResponse.OK && purchases != null) { handlePurchase(purchases, false); } else if (responseCode == BillingClient.BillingResponse.USER_CANCELED) { observer.handlePurchaseCanceled(); } else if (responseCode == BillingClient.BillingResponse.ITEM_ALREADY_OWNED) { observer.handlePurchaseError(new ItemAlreadyOwnedException()); } else { Gdx.app.error(TAG, "onPurchasesUpdated failed with responseCode " + responseCode); observer.handlePurchaseError(new GdxPayException("onPurchasesUpdated failed with responseCode " + responseCode)); } }
observer.handlePurchaseError(new ItemAlreadyOwnedException()); break;