android billing:4.0.0 – queryPurchases(INAPP) and purchase.getSku()

As I mentioned earlier in a comment you are comparing a String to a List object, but as chitgoks said it is ArrayList<String> and not List<String> as i assumed. I’m not sure if you would ever get more than one sku-string (since you probably don’t order multiple things at the same time?) but either look trough them all to be sure or take a chance and compare PRODUCT_ID with only purchase.getSkus().get(0).

The new async call for purchases seems to require only small changes.

Example of old way to do it:

Purchase.PurchasesResult result = billingClient.queryPurchases(BillingClient.SkuType.SUBS);

And this would be the new way to do the same:

billingClient.queryPurchasesAsync(BillingClient.SkuType.SUBS, new PurchasesResponseListener() {
        public void onQueryPurchasesResponse(@NonNull BillingResult billingResult, @NonNull List<Purchase> list) {

Leave a Comment