如何从Google Play控制台获取产品列表(Android)

5

我正在开发我的产品中的Android应用内计费。我想问一下如何获取我已在Google Play控制台注册的所有产品

这是来自Google Play的示例代码。

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

但是如果我添加的附加SKU列表为空,它将不会返回任何内容。

我想提前了解在Google Play控制台的应用内产品中注册的所有产品的信息,以便使用产品信息创建视图。

是否有人遇到过相同的问题?是否有人知道如何解决?

2个回答

4

请授权链接:https://developers.google.com/android-publisher/authorization - deadfish
1
我猜这是可能的,但是没有适用于它的Android SDK。你需要使用Retrofit或类似的工具来组合一些东西。 - zyamys
它只对后端有用,不能在Android应用程序内调用。 - whalemare

3
您无法这样做。嗯,至少我不知道怎么做。
基本上,mHelper.queryInventoryAsync(true, additionalSkuList, mQueryFinishedListener); 最终将直接调用 InAppBillingService.aidl 中的 getSkuDetails() 方法。
 /**
 * 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);

如果您在additionalSkuList中没有指定列表,那么将不会返回任何结果。
简而言之,您只需要知道(并列出)所有的SKU,然后将此列表放入查询中即可。

谢谢您的友善回答!是的,我在尝试后已经知道了~ 没有办法获取所有产品.....无论如何.. - kimkevin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接