We have an app in production that most of the time works fine when users are purchasing a subscription. But we do get some reports of users not being able to get to the purchase screen.
I have identified that these users always get BillingResponseCode.SERVICE_DISCONNECTED when running this code
billingClient.startConnection(object : BillingClientStateListener {
override fun onBillingSetupFinished(billingResult: BillingResult) {
if (billingResult.responseCode == BillingResponseCode.OK) {
oncomplete()
}
else {
onError()
}
}
override fun onBillingServiceDisconnected() {
retry()
}
}
Rerunning the startConnection method does not help and thus these users are stuck. If they try it later(hours or days) it might work just fine again.
We are running version 4.0 of the billing library.
Does anyone have an idea of why this happens?