Android的应用内结算项目的价格 [英] Android In-App billing item price
问题描述
如何应用内计费项目的价格之前,实际上显示了Android市场前端的应用程序内购买进行检索?目前,它看起来像是用户只能找出价格为应用程序内的项目,在购买对话框,我想,以避免对存储的价格在应用程序对所有支持的货币。
How can the price of an in-app billing item be retrieved before actually displaying the android market frontend for the in-app purchase? Currently it looks like the user only can find out the price for an in-app item in the purchase dialog and i would like to avoid to store the prices in the application for all supported currencies.
推荐答案
现在有可能与计费API第3版。你可以用<一个信息href="https://developer.android.com/google/play/billing/billing_reference.html#getSkuDetails"><$c$c>getSkuDetails()$c$c>方法。示例是<一个href="https://developer.android.com/google/play/billing/billing_integrate.html#QueryDetails">here.
It is possible now with Billing API v3. You can get information with getSkuDetails()
method. Example is 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;
}
}
}
这篇关于Android的应用内结算项目的价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!