Hey guys, I’m trying to write a simple coroutine to await a callback and return a value, but for some reason my code hangs and the response never comes. Here’s the gist:
https://gist.github.com/Schadenfeude/8d0ccb88eb1b874d4e3cbf43327fe266
The last log I see is the one on line 19
Maybe you never get result of callback from BillingClient
because if you see this log it means that now non-coroutine code works and coroutine waiting for result of callback
Actually your code looks fine you should get some result from BillingManager
s
Schadenfreude
10/23/2018, 10:07 AM
Yeh, but it never comes, that’s why I’m baffled as to what I’m doing wrong
g
gildor
10/23/2018, 10:08 AM
I would check logs and billingmanager
I have very similar code for GoolgePlay
Maybe you just never get onBillingSetupFinished for some reason
One more note about your solution.
BillingClient has a method to cancel connection, so to avoid leaks use suspendCancellableCoroutine builder and function