Question

I am implementing in-app billing v3 in android application.I can purchased the test product successfully. But in my application there are restore functionality also,I am little bit confusing.

Is it right that in other device application will load all owned item in our application?

Was it helpful?

Solution

Since you are consuming in-app products from google play which is connected with your gmail account, then it's all about your google play account.

Here is a sample method to give you an idea about how it works. I use it in one of my applications.

/**
 * Gets the list of available inventories in GooglePlay for this application
 * 
 * @param productIdList             list of product id's in the store
 *                                  if null, will return owned items only
 * @param inventoryListListener     OnQueryInventoryFinishedListener
 */
public void getInventoryList(List<String> productIdList, InvetoryListInterface inventoryListListener) {

    final InvetoryListInterface listener = inventoryListListener;

    inAppBillingHelper.queryInventoryAsync(productIdList, new QueryInventoryFinishedListener() {

        @Override
        public void onQueryInventoryFinished(IabResult result, Inventory inventroy) {

            if (result.isFailure()) {
                // Failure getting inventory list.
                listener.onInventoryListFailure(result.getMessage());
                return;
            } else {
                // Success getting inventory list.
                listener.onInventoryListSuccess(inventroy);
            }
        }
    });
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top