Closed aftoncreative closed 4 years ago
Hey @aftoncreative , I have just tried this with the ProPlugins version and the even is triggered correctly for a subscription. I checked the code here as well and I dont see a reason why it isn't called, except if the native android side doesn't trigger the intent when a sub is used, but I dont remember seeing such a behavior before.
No further response so closing this one for now. In case you still have problems, please provide more details.
@PeterStaev same here - the event transactionUpdatedEvent
is not triggered at all on some devices (while working on others) - I can't exactly pinpoint the reason (from what I am experiencing it is not API level dependent)
@NickIliev , sadly I dont have an app using the plugin, so that I can gt a broader test devices. During all my dev testing on emulators the event always fired. If you can pinpoint on which it fails, would love to help out.
@PeterStaev after some additional digging it seems that the issue appears when there are multiple Google Accounts on the same device. Although the primary Google Play Account is the one that has made the purchase (and the buyProduct
and restorePurchase
are successfully triggering the transactionUpdatedEvent
) the restorePurchase
is not raising the event on a device where there is more than one Google Account.
I also have a user that claims that he has one single account on the device and that is again experiencing the issue so I will need some more investigation - it appears that the restorePurchase
might not trigger transactionUpdatedEvent
even when the setup is pretty straight-forward
I've just joined ProPlugins and I am currently testing against the proplugin version of the plugin - will let you know as soon as I have more insights.
@PeterStaev some more information.. it seems that it is not related to the multiple accounts as I previously thought.. it is happening on several devices with different API level so I am kinda clueless.
However, I've noticed that the issue might be resolved when using the ProPlugins version... crossing fingers - I am currently deploying in production and will wait for results from users (the only device that was able to fully reproduce the issue on my side is working well with the ProPlugin version).
@PeterStaev unfortunately the ProPlugin is also experiencing the very same issue. I am not sure where an issue for the ProPlugin should be logged so In am posting the information here for now.
Here is what happens:
I am having a managed product that a user buys (buyProduct
) - the event transactionUpdatedEvent
is raised as expected everything works.
On app removal and reinstallation the code triggers restorePurchase
method which should again raise transactionUpdatedEvent
.
The issue: The event transactionUpdatedEvent
is not raised for a number of Android devices in production (when calling restorePruchase
).
The event is raised and working as expected for all devices & emulators in debug mode. I am experiencing the issue on some slower devices like Samsung A3 (Android 8) and Lenovo K10 (Android 6)
@NickIliev I've added the issue (https://git.proplugins.org/Tangra/nativescript-purchase/issues/7) if you want we can continue the discussion there. The login should be the same as the one you use for the ProPlugins NPM
After discussing this further, the problem was that the purchase was getting consumed in code, which makes it unavailable when restoring. After the consume was removed the event is triggering normally.
Hello, getting back to this now since I started experiencing these problems again. The subscription-product sometimes results in an error:
JNI DETECTED ERROR IN APPLICATION: can't call int com.android.billingclient.api.Purchase.getPurchaseState() on null object
-> Any idea? Sometimes it works sometimes it gives this error.
Only place in the plugin where this is "getPurchaseState()" is called is on the file "transaction.android.js". For some reason it seems that the object called here is null at the time of calling.
Hello,
I am using Nativescript Angular for Android.
I am trying to subscribe to a product that I have configured in Google Play console.
I am able to init the product correctly and I am also able to buy the product. The payment dialog works correctly and notifies the user that subscription was successfull. I get an email confirmation about the subscription and I also see it in my Google Play under orders.
However, the event "purchase.transactionUpdatedEvent" is never triggered on subscription products and I have no way of understanding in the program if the subscription have been done to send this info the server.
Have I misunderstood something about the usage and functions of this library? How am I supposed to catch successfull subscription in the app.