0

Using the Google Play Billing v3 library, I want to dynamically list all the products that I have added to the Play Console without having to manually add the product IDs to my code. The following code snippet from the official documentation only shows how to add the product ID manually which is kinda hard-coded.

List<String> skuList = new ArrayList<> ();
skuList.add("premium_upgrade");
skuList.add("gas");
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(SkuType.INAPP);
billingClient.querySkuDetailsAsync(params.build(),
    new SkuDetailsResponseListener() {
        @Override
        public void onSkuDetailsResponse(BillingResult billingResult,
                List<SkuDetails> skuDetailsList) {
            // Process the result.
        }
    });

I will definitely be adding more products time and again and it would be quite inconvenient to manually have to add the product ID to my code and then have to roll out a new version of my app every time this happens. Also, if I have thousands of products, this would be a nightmare. What would be a way to solve this problem?

sammy
  • 185
  • 2
  • 13
  • 1
    try here https://developers.google.com/android-publisher/api-ref/rest/v3/inappproducts/list – from56 Feb 09 '21 at 19:31
  • Hi, thank you so much, this was quite helpful :) If you don't mind, may I also ask if you would happen to know the answer to the problem I posted in the following link: https://stackoverflow.com/questions/66299505/google-play-billing-unable-to-query-some-products-from-play-console – sammy Feb 22 '21 at 13:04

0 Answers0