getSkuDetails() returns 0 items returns empty array DETAILS_LIST [duplicate]
Asked Answered
B

4

7

I am building the "inapp" billing system in my application. After i execute

skuDetails = mService.getSkuDetails(3, "my_app_package_name", "inapp", bundle);
ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");

I always get responseList.size() equal to 0, even if i have set 2 items in "in-app products" in the developer console, and i am passing them to:

ArrayList<String> skuList = new ArrayList<String> ();
skuList.add("first_id");
skuList.add("second_id");
Bundle bundle = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", bundle);

The app is currently in Draft.

The operation result code is 0.

I double checked the base64 key i pass to:

mHelper = new IabHelper(this,Config.getBase64publicKey());

that i got from services and API menu.

I tried .getSkuDetails() both in main thread or in an asynctask.

Can somebody help me out or suggest other things to check?

Beast answered 23/10, 2017 at 11:3 Comment(0)
U
9

Draft app testing is no long supported for testing in-app purchases. Hence you are getting an empty response.

  1. You need to move them to alpha or beta channel or
  2. Add a static response.

https://developer.android.com/google/play/billing/billing_testing.html#draft_apps

Unmindful answered 23/10, 2017 at 11:58 Comment(1)
It worked thanks, i had to wait 10 hours or so before the change became effective. Anyway i didn't find in the docs i had to switch to alpha to do the testing...Beast
W
5

For me personally, I had set the SkuType incorrectly. For example, I had used params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP); instead of params.setSkusList(skuList).setType(BillingClient.SkuType.SUBS); when my app is a subscription based app.

Wadsworth answered 3/8, 2021 at 11:44 Comment(0)
U
3

I experienced the same issue with BillingCient 4.0. My problem was that the development version I was testing against used a different package name than the production version.

Using the correct package name resolved the issue - you can get non-zero sku details from the billing client in a development build.

Unalloyed answered 17/6, 2021 at 1:32 Comment(4)
When you say the development version. Do you mean a version of your application?Commemorative
@Commemorative yesUnalloyed
I finally solved my issues with proguard -keep class * extends com.google.api.client.json.GenericJson { ; } -keep class com.google.api.services.drive. { *; } -keepclassmembers class com.google.api.client.util.Key { *; } and moving it to an alphaCommemorative
OMG give this chap a beer, I feel so stupid, I had applicationIdSuffix ".debug" in the gradle filesPrudenceprudent
Z
1

Previously you could test an app by uploading an unpublished "draft" version. This functionality is no longer supported. However, you can test your app with static responses even before you upload it to the Google Play Store. For more information, see Test with static responses.

Source official documentation

Zakaria answered 27/8, 2019 at 9:43 Comment(1)
whoever made it like this has no brain. It's a real beauty.Subcortex

© 2022 - 2024 — McMap. All rights reserved.