I have an issue with In App Billing. I am using the helper class from the TrivialDrive sample.
Here is how I implement it.
This works fine on one device, however if a user buys on one device then attempts it on another device the second device works as follows:
The helper sets up as normal, then when it checks inventory, it finds no item purchased (I understand there is a delay before this updates). It then attempts to purchase, but says item already bought on the Google play window. This would be fine if I could detect this in code, but it returns to the listener that the user canceled the purchase.
Is there a way to detect that the user has already bought the item using the purchaseFinishedListener
?
The code in the handleActivityResult
method returns User Canceled
else if (resultCode == Activity.RESULT_CANCELED) {
logDebug("Purchase canceled - Response: " + getResponseDesc(responseCode));
result = new IabResult(IABHELPER_USER_CANCELLED, "User canceled.");
if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);
}
I added the line if (responseCode==BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED) result = new IabResult(BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED, "Success");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With