I have two functions that read the available products to buy, one reads inapp, the other reads subs. Each can be called separately or consecutively.
The problem is that if I call the function one after the other, then the second function returns an error:
BillingResult IsSuccess = False, ResponseCode = DEVELOPER_ERROR
Debug string: Client is already in the process of connecting to billing service.
It seems to me that the asynchronous connect did not end when the first function was called. How to solve it?
I could combine both functions into one with one connect, but here we have duplication in the code. Or read BillingClient.ConnectionState and react accordingly? How to get BillingClient.ConnectionState :
B4X:
Public Sub GetInAppProducts(lSKUs As List) As ResumableSub
'make sure that the store service is connected
Wait For (billing.ConnectIfNeeded) billing_Connected (Result As BillingResult)
'get the sku details
If Result.IsSuccess Then
....
Public Sub GetSubscriptions(lSKUs As List) As ResumableSub
'make sure that the store service is connected
Wait For (billing.ConnectIfNeeded) billing_Connected (Result As BillingResult)
'get the sku details
If Result.IsSuccess Then
....
The problem is that if I call the function one after the other, then the second function returns an error:
BillingResult IsSuccess = False, ResponseCode = DEVELOPER_ERROR
Debug string: Client is already in the process of connecting to billing service.
It seems to me that the asynchronous connect did not end when the first function was called. How to solve it?
I could combine both functions into one with one connect, but here we have duplication in the code. Or read BillingClient.ConnectionState and react accordingly? How to get BillingClient.ConnectionState :
BillingClient.ConnectionState | Android Developers
developer.android.com