Search code examples
javaandroidin-app-purchasein-app-billingandroid-billing

get purchased item detail at start of app with IabHelper android


I have implemented In-App in my application in that there is list of images with grid when user select image if user has already purchased that item it should never called again otherwise it should called method of

   mHelper.launchPurchaseFlow(this, SKU_PREMIUM, RC_REQUEST,
                mPurchaseFinishedListener, "");

i have successfully integrate in-app with my app and also item is being purchased but i want to know at start up if that item is purchased or not if not purchased than above code should be called otherwise it should allow to download that image


Solution

  • Finally i found solution of how to get information of purchased item if it is already purchased or not

        // subscriptions we own
    IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
        public void onQueryInventoryFinished(IabResult result,
                Inventory inventory) {
            if (result.isFailure()) {
                complain("Failed to query inventory: " + result);
                return;
            }
    
            mIsPremium = inventory.hasPurchase(SKU_PREMIUM); ------> By here you can get information 
    
        }
    };