override fun onPurchasesUpdated(billingResult: BillingResult, purchases: List<Purchase>?) {
if (billingResult.responseCode == BillingResponseCode.OK && purchases != null) {
for (purchase in purchases) {
handlePurchase(purchase)
}
} else if (billingResult.responseCode == BillingResponseCode.USER_CANCELED) {
// Handle an error caused by a user cancelling the purchase flow.
} else {
// Handle any other error codes.
}
}
suspend fun handlePurchase(purchase: Purchase) {
val skus = purchase.skus
}
구글 인앱 결제를 구현하던 중 오류가 떴다.
'getter for skus: ArrayList<String!>' is deprecated. Deprecated in Java
getSkus() 는 deprecated 되어 getProducts() 를 사용해야 한다고 한다.
suspend fun handlePurchase(purchase: Purchase) {
val productsId = purchase.products
}
참고 :
https://developer.android.com/google/play/billing/integrate?hl=ko&_gl=1*1c9locg*_up*MQ..*_ga*OTI4NTk4MzcxLjE3MjM1MzczNzA.*_ga_6HH9YJMN9M*MTcyMzU5ODQxOC4yLjAuMTcyMzU5ODQxOC4wLjAuMA..
https://developer.android.com/reference/com/android/billingclient/api/Purchase#getProducts()