Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getSkuDetails() returns 0 items returns empty array DETAILS_LIST

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?

like image 584
Romeo Avatar asked Oct 23 '17 11:10

Romeo


2 Answers

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

like image 122
Amod Gokhale Avatar answered Oct 18 '22 09:10

Amod Gokhale


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.

like image 31
mechdon Avatar answered Oct 18 '22 10:10

mechdon