How to test in-app billing and getSkuDetails?

2.9k views Asked by At

1) Uploaded .apk with

<uses-permission android:name="com.android.vending.BILLING"/>

2) Added items to the application's product list. And they are Active.

3) Have test account.

mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener()

works fine

but after

mHelper.queryInventoryAsync(mGotInventoryListener) 

or

Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), type, skusBundle);

or like here

I see empty list of items in response. skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST) is true

So what should i do to get items information?

1

There are 1 answers

1
marmor On

I was able to retrieve my in-app products active and in-active, on unsigned and signed apks, so I don't think this is a restriction in Google's side.

You should check your "type", if it's "subs" then it'll return subscription products rather then regular in-app products. Also, make sure you passing a string array of all the product-ids you wish to get info about, as such:

    ArrayList<String> productIds = new ArrayList<String>();
    productIds.add(your_product_id);
    // ... add more product ids here if needed ...
    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList("ITEM_ID_LIST", productIds);
    result = mService.getSkuDetails(3, your_package_name, "inapp",
                querySkus);
    // use "subs" instead of "inapp" for subscriptions