Reputation: 197
I update IAB Helper from TrivialDrive in my app. QueryInventoryFinishedListener start get result.isFailure() if no internet connection. In earlier version of IAB Helper everything works fine without result.isFailure() even if no internet connection for a weeks.
It is a feature of new version of IAB Helper or I'm doing wrong something?
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
Log.d(TAG, "Query inventory finished.");
if (mHelper == null) {
Log.d(TAG, "null: " + result);
return;
}
if (result.isFailure()) {
Log.d(TAG, "Failed to query inventory: " + result);
return;
}
Log.d(TAG, "Query inventory was successful.");
Purchase proPurchase = inventory.getPurchase(SKU_PRO);
mIsPro = (proPurchase != null);`
Upvotes: 1
Views: 595
Reputation: 10621
In-app Billing service, that the IabHelper talks to, caches the purchase history and is able to query the inventory offline. But some options (like not providing the list of target SKUs or requesting SKU details) enforce the service to talk to the server, which is not possible without internet connection. So, if you want to be able to query the inventory offline, do it this way:
boolean querySkuDetails = isNetworkAvailable();
mHelper.queryInventoryAsync(querySkuDetails, skuList, this);
Upvotes: 3