Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions library/src/org/onepf/oms/appstore/googleUtils/IabHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,16 @@ protected IInAppBillingService getServiceFromBinder(IBinder service) {
public void dispose() {
logDebug("Disposing.");
mSetupDone = false;
if (mServiceConn != null) {
if (mService != null) {
logDebug("Unbinding from service.");
if (mContext != null) mContext.unbindService(mServiceConn);
mServiceConn = null;
if (mContext != null && mServiceConn != null) {
mContext.unbindService(mServiceConn);
}
mService = null;
mPurchaseListener = null;
}
mPurchaseListener = null;
mContext = null;
mServiceConn = null;
}

/**
Expand Down Expand Up @@ -435,6 +438,12 @@ requestCode, new Intent(),

result = new IabResult(IABHELPER_REMOTE_EXCEPTION, "Remote exception while starting purchase flow");
if (listener != null) listener.onIabPurchaseFinished(result, null);
} catch (Exception e) {
logError("Exception while launching purchase flow for sku " + sku);
e.printStackTrace();

result = new IabResult(IABHELPER_UNKNOWN_ERROR, "Exception while starting purchase flow : " + e.getMessage());
if (listener != null) listener.onIabPurchaseFinished(result, null);
}
flagEndAsync();
}
Expand Down Expand Up @@ -994,11 +1003,13 @@ int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus) throw

ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

for (String thisResponse : responseList) {
SkuDetails d = new SkuDetails(itemType, thisResponse);
d.setSku(OpenIabHelper.getSku(appstore.getAppstoreName(), d.getSku()));
logDebug("querySkuDetails() Got sku details: " + d);
inv.addSkuDetails(d);
if (responseList != null) {
for (String thisResponse : responseList) {
SkuDetails d = new SkuDetails(itemType, thisResponse);
d.setSku(OpenIabHelper.getSku(appstore.getAppstoreName(), d.getSku()));
logDebug("querySkuDetails() Got sku details: " + d);
inv.addSkuDetails(d);
}
}
}

Expand Down