I am trying to wrap this library into a reactive approach, and I'm having trouble understanding the lifecycle of this method.
Is it:
a/ Blocking the current thread until it gets a true/false response?
b/ Delivering a request that comes in the Billing Processor? In which method does it confirm that loading is complete?
My tests have shown that 2 doesn't imply a response on onPurchaseHistoryRestored.
After the response is received on either method, do you still have to call listOwnedSubscriptions?
I guess its synchronous, so it "a"
What happens if there is an error? Where is it propagated? A false lacks context.
currently its just returning a false value
@serggl If it is synchronous there could be an issue in https://github.com/anjlab/android-inapp-billing-v3/blob/master/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java#L87
Google states that onServiceConnected is called on the Main Thread. If the method is synchronous this could block the main thread.
We are seeing this on some devices where the app ANRs blocking there:
at android.os.BinderProxy.transact(Native Method)
at com.a.a.a.c.a(IInAppBillingService.java:405)
at com.anjlab.android.iab.v3.c.a(BillingProcessor.java:160)
at com.anjlab.android.iab.v3.c.e(BillingProcessor.java:187)
at com.anjlab.android.iab.v3.c$1.onServiceConnected(BillingProcessor.java:87)
I'm pretty sure that this is because loadOwnedPurchasesFromGoogle blocks the main thread.
Maybe the logic in onServiceConnected should be called on an separate thread ?
Why isnt this issue addressed yet? I still have a 3 second delay in my app start just to check if the user has purchased items. Or is there any way to check it without the block?
Any solution?
Would someone mind making PR?
volunteers? :)
this was likely fixed with #207
Most helpful comment
@serggl If it is synchronous there could be an issue in https://github.com/anjlab/android-inapp-billing-v3/blob/master/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java#L87
Google states that onServiceConnected is called on the Main Thread. If the method is synchronous this could block the main thread.
We are seeing this on some devices where the app ANRs blocking there:
I'm pretty sure that this is because
loadOwnedPurchasesFromGoogleblocks the main thread.Maybe the logic in
onServiceConnectedshould be called on an separate thread ?