6

I am making in-app purchases like TrivialDrive. Call queryInventoryAsync:

 mHelper.queryInventoryAsync(mGotInventoryListener);

mGotInventoryListener:

IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
    public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

        String price = inventory.getSkuDetails(SKU_ALL_INCLUSILE).getPrice();
        Log.d("SKU", "price " + price);
    }
};

OnClick work perfectly and I can make purchase. But getPrice() method produces NPE. Help me please! I want to show SKU information in ListView.

SOLVED! Just use:

 mHelper.queryInventoryAsync(true, skuList, mGotInventoryListener);
Illya Bublyk
  • 712
  • 6
  • 21
  • I still don't understand why in Trivialdrive sample they use this line to get info: mHelper.queryInventoryAsync(mGotInventoryListener); when you dive deep in this call you will find that it invokes the following: queryInventoryAsync(false, null, null, listener); - and this will always return empty Inventory in listener callback! Why in the world they did that?! – Kirill Karmazin May 11 '17 at 12:41

0 Answers0