假设我的应用在可用于不同国家/地区的 Play 商店中。由于根据国家,应用程序价格会发生变化,所以我想根据国家/地区获取应用程序价格。这个怎么做?
Bundle querySkus = new Bundle();
querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList);
Bundle skuDetails = null;
try {
skuDetails = mService.getSkuDetails(3, mContext.getPackageName(),
ITEM_TYPE_INAPP, querySkus);
} catch (RemoteException e) {
e.printStackTrace();
}
int response = skuDetails.getInt("RESPONSE_CODE");
if (response == 0) {
ArrayList<String> responseList
= skuDetails.getStringArrayList("DETAILS_LIST");
for (String thisResponse : responseList) {
JSONObject object = null;
try {
object = new JSONObject(thisResponse);
String sku = object.getString("productId");
String price = object.getString("price");
Log.d("IabHelper", "Test sku = " + sku + " && price = " + price);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
上面的代码根据我的国家给出了应用程序的价格。其他国家的其他用户将如何获得它?谷歌播放服务会处理它还是我需要使用不同的代码?如果是,那么如何?