-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android Pending Payments Confusion - IPurchasesUpdatedListener Implementation #384
Comments
So, as of right now there is no callback that you can subscribe to in the library when a purchase is updated. ... Maye I will add that in. https://developer.android.com/google/play/billing/integrate#pending says: When your app receives a new purchase, either through your PurchasesUpdatedListener or as a result of calling queryPurchases(), use the getPurchaseState() method to determine whether the purchase state is PURCHASED or PENDING So, my recommendation is to just |
So i did -> #385 What i did here is made You can connect on startup and register for Plugin.InAppBilling.InAppBillingImplementation.OnAndroidPurchasesUpdated = (billingResult, purchases) =>
{
// decide what you are going to do here with purchases
}; Does that make sense? |
This does make a stack of sense. Thanks James, much more convenient, obvious and explicit. |
Cools, i will try to push a thing out in the next few days |
Would be good to have an example usage I think. Since the general advice in the documentation follows connect -> do your thing -> disconnect, it would be good to document how this should be treated in a similar or different manner. It would suggest from the approach above that you connect during app initialisation and would need to then remain connected in order to receive the events. Unless I'm actually reading this wrong myself at the moment. |
Add callback on Android for on purchases updated
Sorry to pick on the closed issue, but I have the weirdest thing happening: Xamarin app, latest version of billing plugin. In my MainActivity I added the recommended code snippet to add purchase update listener. Any ideas? The web is silent... |
Should be there... https://github.com/jamesmontemagno/InAppBillingPlugin/blob/master/src/Plugin.InAppBilling/InAppBilling.android.cs#L29 Make sure that you are compiling your Android app against Android 10 + |
I'm just looking at how to deal with Pending payments on Android. After reading the plugin docs and the google docs it states that in order to receive updates we should implement
PurchasesUpdatedListener
- in XF by implementingIPurchasesUpdatedListener
.This all sounds fine and reasonable in principal but I'm a still a little confused.
The
InAppBillingPlugin
also sets it's own listener internallyInAppBillingPlugin/src/Plugin.InAppBilling/InAppBilling.android.cs
Line 60 in a0d0f3c
This leads me to think that if I also register a listener in my
MainActivity
won't this result in getting multiple updates during a normal purchasing process? Both the Plugin and `MainActiivty listener would be registered at that point.It looks like this Plugin listener would be disconnected in the call to
DisconnectAsync();
, which is called in my code immediately after any billing processes.At that point it seems to make sense to have the
MainActiivty
listener to then process any updates changing a Pending into Cancelled or Purchased outside of theConnect() Disconnect()
flow.Are there any examples of handling this?
The text was updated successfully, but these errors were encountered: