Android计费库V3.0.0不工作
它不起作用。就这么简单。我使用了谷歌文档中给出的默认代码Android计费库V3.0.0不工作,android,android-billing,play-billing-library,Android,Android Billing,Play Billing Library,它不起作用。就这么简单。我使用了谷歌文档中给出的默认代码 private fun initBilling() { val purchasesUpdatedListener = PurchasesUpdatedListener { billingResult, purchase -> Log.d("Billing", billingResult.debugMessage) } val billingC
private fun initBilling() {
val purchasesUpdatedListener = PurchasesUpdatedListener { billingResult, purchase ->
Log.d("Billing", billingResult.debugMessage)
}
val billingClient = BillingClient.newBuilder(this@Home)
.setListener(purchasesUpdatedListener)
.enablePendingPurchases()
.build()
billingClient.startConnection(object : BillingClientStateListener {
override fun onBillingSetupFinished(billingResult: BillingResult) {
Log.d("Billing", billingResult.debugMessage
?: "billing setup finished with response code ${billingResult.responseCode}")
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
// The BillingClient is ready. You can query purchases here.
CoroutineScope(Dispatchers.IO).launch {
querySkuDetails(billingClient)
}
}
}
override fun onBillingServiceDisconnected() {
// Try to restart the connection on the next request to
// Google Play by calling the startConnection() method.
Log.d("Billing", "disconnected")
}
})
}
我使用的日志都没有打印出来,也没有显示错误。启动连接不会从BillingClientStateListener触发任何方法。android计费库v3.0.0存在未知问题。只是切换到2.1.0有所帮助