ran*_*guy 21 android in-app-purchase google-play
在Android应用程序计费中,是否可以使用一个查询以某种方式查询所有产品的(价格)信息?最理想的情况是,您可以传递产品ID,并返回信息.
我正在寻找的是Android Market的SKProductsRequest等价物.http://developer.apple.com/library/ios/#documentation/StoreKit/Reference/SKProductsRequest/Reference/Reference.html#//apple_ref/occ/cl/SKProductsRequest
Ser*_*tov 15
现在可以使用Billing API v3.您可以通过getSkuDetails()
方法获取信息.示例在这里.
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;
}
}
}
Run Code Online (Sandbox Code Playgroud)