PeterStaev / nativescript-purchase

:moneybag: A NativeScript plugin for making in-app purchases!
Apache License 2.0
82 stars 28 forks source link

[Question] Loading products is really slow #41

Closed Tompote closed 6 years ago

Tompote commented 6 years ago

Hi ! Thanks for this awesome plugin, it works great. However my products take a really long time to load using the purchase.getProducts() function. I only have 5 activated products on the Google side and it take about 30 seconds for the promise to return (Internet connection is fine and everything else loads pretty fast).

I'm using NS 4.0 with Angular 5.3 and NS-purchase 2.0.2.

r0zar commented 6 years ago

I also have seen this issue, and am working on a workaround.

I'm curious, have you been able to test this on iOS/iTunes yet?

PeterStaev commented 6 years ago

I've just tested with the demo app. After the TNS is booted it takes 10 secs to get the native android APIs to output that the Google Account has been established and then another 10 secs to return the list. I'm not sure if this is normal or not.

Right now I do not have the resources to trace this further. But the full code (including the source of the native android helper) is available in this repo, so feel free to add some tracing and try to troubleshoot this.

Tompote commented 6 years ago

My colleague @Heer0 found the issue. In the InAppBillingHelper there is a sleeping loop that makes you wait 10 seconds, even if the service is already loaded. We'll make you a PR ;).

RoyiNamir commented 6 years ago

@heer0 . Same here huge delay. Pr time maybe?

Heer0 commented 6 years ago

Pr #44 fix this issue but is not yet merge