Google Play Billing Library - querySkuDetailsAsync occasionally returns BillingResponseCode.ERROR (6) Google Play Billing Library - querySkuDetailsAsync occasionally returns BillingResponseCode.ERROR (6) android android

Google Play Billing Library - querySkuDetailsAsync occasionally returns BillingResponseCode.ERROR (6)


For future reference and some other people suffering from this (like me at IAB 3.0.1), someone at the issue tracker bug that OP opened posted a comment about how we should react if we receive this code

Error 6 (https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#error) usually represents a transient error from our backend servers. This error code should trigger a retry which in most cases should succeed.

LINK: https://issuetracker.google.com/issues/139631105#comment11

example code:

@Overridepublic void onSkuDetailsResponse(@NonNull BillingResult billingResult, @Nullable List<SkuDetails> list) {    Utils.log("BILLING: onSkuDetailsResponse(). Result (" + billingResult.getResponseCode() + ") List size: " + (list == null ? "null" : list.size()));    if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && list != null) {        if (mSkuQueryErrorCounter > 0) mSkuQueryErrorCounter--;        // process the SkuDetail list...        }    } else {        // https://issuetracker.google.com/issues/139631105#comment11        mSkuQueryErrorCounter++;        if (mSkuQueryErrorCounter <= 2) scheduleUpdate(NOW);        else if (mSkuQueryErrorCounter < 5) scheduleUpdate(TEN_SECONDS);        else if (mSkuQueryErrorCounter < 10) scheduleUpdate(ONE_HOUR);        else scheduleUpdate(ONE_DAY);    }}