anjlab / android-inapp-billing-v3

A lightweight implementation of Android In-app Billing Version 3
Other
2.2k stars 536 forks source link

[Critical Bug] USER_CANCELLED is no longer triggered when users close the iAP overlay without purchasing #516

Open max-critcrew opened 2 years ago

max-critcrew commented 2 years ago

Hey everyone,

we just updated our game to the latest version ('com.anjlab.android.iab.v3:library:2.0.3') and now the following listener method is no longer being called when the user cancels the purchase overlay:

  @Override
  public void onBillingError(int errorCode, Throwable error) {
    /*
    * Called when some error occurred. See Constants class for more details
    * 
    * Note - this includes handling the case where the user canceled the buy dialog:
    * errorCode = Constants.BILLING_RESPONSE_RESULT_USER_CANCELED
    */
  }

I've tried breakpoints in all kinds of methods to see if the cancellation is triggered anywhere - but it seems like cancelled purchases are no longer triggered at all. This is quite a big problem for us, since we've been showing a loading indicator and removed it again in the cancelled-callback.

This is reproduced live on the Google Play Store (unfortunately, I didn't catch it in testing). But it also happens in debug builds with license testers, etc.

max-critcrew commented 2 years ago

It seems like the information is only coming through here now, but you can't access these information without modifying the library (as far as I understand it so far):

public void onPurchasesUpdated(@NonNull BillingResult billingResult,
                                    @Nullable List<Purchase> purchases)
serggl commented 2 years ago

@max-critcrew the community here would appreciate if you can provide a patch/PR for this issue

max-critcrew commented 2 years ago

@serggl I would love to, but I'm not entirely sure if I really understand the details of the library completely. I just figured out that the cancel event is no longer fired, but you can get it somewhere else. I have no idea if that only happens on certain android version - or if this was tested by the main developers of this library.

It would be amazing if somebody who wrote this part of the code could look at it and then provide an update.

max-critcrew commented 2 years ago

@serggl Pull request issued: https://github.com/anjlab/android-inapp-billing-v3/pull/517