【发布时间】:2014-11-04 08:23:35
【问题描述】:
我的 Android 应用正在使用 In-App-Purchases / In-App-Billing,到目前为止,整个过程运行良好。我唯一的问题是有时货币会在此过程中发生变化。我的意思是,当我使用mHelper.queryInventoryAsync() 查询库存时获得的价格/货币有时与用户单击要购买的商品时显示的价格/货币不同。
例如,有一个来自希腊的用户,由于某种原因,queryInventory 方法返回了以英镑为单位的价格,并且只有在用户单击要购买的产品后,google 才向他显示以欧元为单位的价格。用户后来告诉我,他的 Nexus 7 来自英国,但他的信用卡来自希腊。所以这可以解释它,但它仍然让他感到困惑,并且看到它已经发生在我的一个测试用户身上,我可以想象这种情况会更频繁地发生。
此外,如果应用在此过程中更改货币,我也不确定从法律上讲是否可以,用户可能不知道谷歌在这方面有过错。
所以我在这里要问的是,有没有一种简单的方法可以在我查询库存时强制谷歌显示最终价格?或者有没有一种简单的方法可以找出用户将支付的货币(可能从他的 sim 卡中获取国家)并使用国家变量查询谷歌库存?
提前谢谢你。
这是我的代码:
// googles IabHelper class
private IabHelper mHelper;
// this carries my products, gets filled in my activity by a request to my server
private List<String> additionalSkuList = new ArrayList<String>();
mHelper.queryInventoryAsync(true, additionalSkuList,
mGotInventoryListener);
// Listener that's called when we finish querying the items and subscriptions we own
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
L.debug("Query inventory finished.");
// Have we been disposed of in the meantime? If so, quit.
if (mHelper == null) return;
// Is it a failure?
if (result.isFailure()) {
L.debug("Failed to query inventory: " + result);
return;
}
Set<String> skuKeys = inventory.getSkuKeys();
List<String> exceptList=new ArrayList<String>();
mHelper.flagEndAsync();
for (final String sku: skuKeys) {
// this price is not always the one which will be shown when someone
// would start the IAB process
String price = inventory.getSkuDetails(sku).getPrice();
}
};
【问题讨论】:
-
是的,您阅读我的问题了吗?它对我使用不同的货币没有帮助。
标签: android in-app-purchase in-app-billing