Converting my own http calls to KTor (& therefore coroutines) is a bit hollow, or at least not terribly satisfying, without also being able to convert Play Store API calls and their callbacks to use suspend functions.
This general answer, with specific example of a different API, is fabulous and I've managed to use it to produce something for "startBillingClient", as follows
private suspend fun BillingClient.startConnection(value: Int) =
suspendCoroutine<Unit> { cont ->
val callback = object: BillingClientStateListener {
override fun onBillingSetupFinished(billingResult:
BillingResult) {
isServiceConnected = true
}
override fun onBillingServiceDisconnected() {
isServiceConnected = false
startConnection(this)
}
}
startConnection(callback)
}
but now I'm struggling with producing something similar for querySkuDetailsAsync, which seems to be due to needing to pass parameters in. Should be easy, but...