ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Android如何从GooglePlay控制台获取产品列表

2019-05-28 09:11:18  阅读:566  来源: 互联网

标签:android google-play in-app-purchase in-app-billing


我正在开发我的产品中的Android In-app Billing.我想问你如何获得我已经通过Google Play控制台注册的所有产品.

这是Google Play的示例代码.

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

但如果我把additionalSkuList放在什么都没有,它什么都不会返回.

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

有人有同样的问题吗?有谁知道解决它的方法?

解决方法:

你不能.好吧,不是我知道的.

基本上是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,然后将此列表放入查询中.

标签:android,google-play,in-app-purchase,in-app-billing
来源: https://codeday.me/bug/20190528/1169970.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有