I'm developing an Android app and I am now at a point where I'm implementing in-app purchases. I have followed Android Developers' own guide to do this. However, when I launch my app, I get the following log in the console:
W/BillingClient: In-app billing API version 3 is not supported on this device.
I call the method setUpBillingClient()
in my onCreate method in my MainActivity
. The rest of the calls are like so:
private fun setUpBillingClient() {
billingClient = BillingClient.newBuilder(this)
.setListener(purchaseUpdateListener)
.enablePendingPurchases()
.build()
startConnection()
}
private val purchaseUpdateListener = PurchasesUpdatedListener { billingResult, purchases ->
}
private fun startConnection() {
billingClient?.startConnection(object : BillingClientStateListener {
override fun onBillingSetupFinished(billingResult: BillingResult) {
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
Log.v("TAG_INAPP","Setup Billing Done")
// The BillingClient is ready. You can query purchases here.
queryAvaliableProducts()
}
}
override fun onBillingServiceDisconnected() {
Log.v("TAG_INAPP","Billing client Disconnected")
// Try to restart the connection on the next request to
// Google Play by calling the startConnection() method.
}
})
}
I am not getting any of the logs from the startConnection()
method. I cannot seem to find anyone with a similar issue by Googling the issue. I have tried to use different emulators and different API's to see if it was the emulated device that was not compatible, but all of them gave the same error. Any suggestions?
I have also tried to implement the remaining code (complete purchaseUpdateListener
and handlers for the purchases), but it still does not work. Something goes wrong at the beginning of the flow.