Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android How to get product list from GooglePlay console

I'm developing Android In-app Billing in my product. I want to ask you about how to get all products that I already registered by Google play console.

It's sample code from Google play.

List additionalSkuList = new List();
additionalSkuList.add(SKU_APPLE);
additionalSkuList.add(SKU_BANANA);
mHelper.queryInventoryAsync(true, additionalSkuList, mQueryFinishedListener);

but If I put additionalSkuList is nothing, It will return nothing.

I want to know all products that I registered in In-app Products of Google play console to make Views by using product's information in advance.

Anyone has same problem ? Anyone knows a way to solve it ?

like image 846
kimkevin Avatar asked Jul 01 '15 03:07

kimkevin


2 Answers

This is now possible using the Google Play Developer API (a.k.a. android-publisher):

https://developers.google.com/android-publisher/

In particular, the Inappproducts: list API:

List all the in-app products for an Android app, both subscriptions and managed in-app products.

like image 154
Jamie Cockburn Avatar answered Nov 14 '22 04:11

Jamie Cockburn


You can't. Well, not that I'm aware of.

Basically mHelper.queryInventoryAsync(true, additionalSkuList, mQueryFinishedListener); eventually calls to getSkuDetails() method straight from InAppBillingService.aidl

 /**
 * Provides details of a list of SKUs
 * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
 * with a list JSON strings containing the productId, price, title and description.
 * This API can be called with a maximum of 20 SKUs.
 * @param apiVersion billing API version that the Third-party is using
 * @param packageName the package name of the calling app
 * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
 * @return Bundle containing the following key-value pairs
 *         "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
 *              failure as listed above.
 *         "DETAILS_LIST" with a StringArrayList containing purchase information
 *              in JSON format similar to:
 *              '{ "productId" : "exampleSku", "type" : "inapp", "price" : "$5.00",
 *                 "title : "Example Title", "description" : "This is an example description" }'
 */
Bundle getSkuDetails(int apiVersion, String packageName, String type, in Bundle skusBundle);

If you specify no list in your additionalSkuList, then you will get nothing as returned result.

In short, you just have to know (and list) all SKUs, then put this list into the query.

like image 29
Fadils Avatar answered Nov 14 '22 04:11

Fadils