我试图在我的Android应用中使用Google应用内结算购买后获取价格和货币代码。
成功购买后,我查询相同SKU的库存但我得到了空白
new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
if (result.isFailure()) {
return;
} else if (purchase.getSku().equals(MY_SKU)) {
if (purchase.getPurchaseState() == 0) {
try {
Inventory inventory = appBillingHelper.queryInventory();
price = inventory.getSkuDetails(MY_SKU).getPrice(); // CRASHES WITH A NULL POINTER EXCEPTION for SkuDetails.
currencyCode = inventory.getSkuDetails(MY_SKU).getPriceCurrencyCode();
答案 0 :(得分:1)