在Android的应用程序计费中,是否可以使用一个查询来查询所有产品的(价格)信息?最理想的情况是,您可以传入产品ID,然后它将返回这些ID的信息。
我正在寻找的是安卓市场的SKProductsRequest等价物。http://developer.apple.com/library/ios/#documentation/StoreKit/Reference/SKProductsRequest/Reference/Reference.html#//apple_ref/occ/cl/SKProductsRequest
发布于 2011-06-05 15:46:00
现在可以使用计费接口v3。您可以使用getSkuDetails()
方法获取信息。here就是一个例子。
ArrayList skuList = new ArrayList();
skuList.add("premiumUpgrade");
skuList.add("gas");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
Bundle skuDetails = mService.getSkuDetails(3, getPackageName(), "inapp", querySkus);
int response = skuDetails.getInt("RESPONSE_CODE");
if (response == 0) {
ArrayList responseList = skuDetails.getStringArrayList("DETAILS_LIST");
for (String thisResponse : responseList) {
JSONObject object = new JSONObject(thisResponse);
String sku = object.getString("productId");
String price = object.getString("price");
if (sku.equals("premiumUpgrade")) {
mPremiumUpgradePrice = price;
} else if (sku.equals("gas")) {
mGasPrice = price;
}
}
}
https://stackoverflow.com/questions/5912538
复制相似问题