Billing in the Trivial Drive Android App

I make in-app purchases such as 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 works great and I can make a purchase. But the getPrice () method creates an NPE. Help me please! I want to show SKU information in a ListView.

DECIDE! Just use:

 mHelper.queryInventoryAsync(true, skuList, mGotInventoryListener);
+4
source share

Source: https://habr.com/ru/post/1612031/


All Articles