code-with-max / godot-google-play-iapp

AndroidIAPP is a plugin for the Godot 4.2+ game engine. It provides an interface to work with Google Play Billing Library version 7. The plugin supports all public functions of the library, passes all error codes, and can work with different subscription plans.
MIT License
39 stars 3 forks source link

Equivalent to _on_billing_resume()? #9

Open djrain opened 1 month ago

djrain commented 1 month ago

Hey, thanks for the updated plugin! The only issue is that I don't see an equivalent function to _on_billing_resume() as in the official repo:

Screenshot 2024-08-11 at 12 58 08 PM

Or perhaps this is handled automatically?

code-with-max commented 1 month ago

@djrain https://developer.android.com/google/play/billing/integrate#ooap Now that the purchase update functions work like coroutines, you don't need to call them separately. They work all the time. To check the current status of purchases, it is enough to call the function:

queryPurchases(productType: String)
productType: "inapp" for products or "subs" for subscriptions.
Handling purchases made [outside your app](https://developer.android.com/google/play/billing/integrate#ooap).

If the application was launched, restarted, or at any other time, just call it and all current purchases will be received in the query_purchases callback.

djrain commented 1 month ago

I see what you're saying, I think, it's just that the linked docs still instruct to call queryPurchases() in onResume() to catch updates that happened while in the background, and currently it's not clear how to handle this in Godot. I suppose one could detect returning to the foreground with NOTIFICATION_APPLICATION_FOCUS_IN, but this notification was only added in Godot 4.3, and even then I'm not confident if that's quite the same thing as onResume(). Even if just for parity between our code and the official docs, I think it would be nice to have this signal like the official repo does, if possible