简体   繁体   中英

How to test in-app billing and getSkuDetails?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM