Android IAB v5: Querying product details is not supported

Viewed 281

I am upgrading my app from IAB v1 to IAB v5.

I can successfully connect the Billing Client.

But if I then try to query product details, I get the warning from BillingClient:

Querying product details is not supported.

The query code is copied from the documentation:

        QueryProductDetailsParams queryProductDetailsParams =
                QueryProductDetailsParams.newBuilder()
                        .setProductList(
                                List.of(
                                        QueryProductDetailsParams.Product.newBuilder()
                                                .setProductId("premium")
                                                .setProductType(BillingClient.ProductType.INAPP)
                                                .build()))
                        .build();

        billingClient.queryProductDetailsAsync(
                queryProductDetailsParams,
                new ProductDetailsResponseListener() {
                    public void onProductDetailsResponse(BillingResult billingResult,
                                                         List<ProductDetails> productDetailsList) {
                        // check billingResult
                        // process returned productDetailsList
                        Log.d(TAG, "Got details for " + productDetailsList.size() + " products." );
                    }
                }
        );

The onProductDetailsResponseListener() method is called, but the product details list is empty.

The premium product ID is a valid one, which was successfully purchased many times using the IAB v1 library.

Why do I get this warning message? Why is querying details not supported?

My gradle file pulls in IAB v5:

dependencies {
    ...
    api 'com.android.billingclient:billing:5.0.0'
}

UPDATE 1

If I check feature support via the API using:

billingClient.isFeatureSupported(BillingClient.FeatureType.PRODUCT_DETAILS);

I also get back Response Code: FEATURE_NOT_SUPPORTED, Debug Message: Client does not support ProductDetails.

The phone I test with has API 19 of the OS.

UPDATE 2

It is worse than I thought! Without a product details result, I am unable to launch a purchase flow! At least with IAB v1, you could purchase without getting SKU details first.

UPDATE 3

Whether product details feature is supported, seems to depend on the device.

With an API30 device, I get the feature support status:

PRODUCT_DETAILS support: Response Code: OK, Debug Message:

The IAB guide does not mention it, but it looks to me that IAB v5 is incompatible with an API19 device.

0 Answers
Related