fun purchase(activity: Activity, product: ProductDetails) {
if (activity.isFinishing || activity.isDestroyed) {
Log.e("Billing", "Invalid Activity: Cannot launch billing flow")
return
}
onConnected {
activity.runOnUiThread {
val productDetailsParams = BillingFlowParams.ProductDetailsParams.newBuilder()
.setProductDetails(product)
.build()
val billingFlowParams = BillingFlowParams.newBuilder()
.setProductDetailsParamsList(listOf(productDetailsParams))
.build()
billingClient.launchBillingFlow(activity, billingFlowParams)
}
}
}
I don't understand why it is not working ? I searched a lot but could not find anywhere which reasons are directly affect only payment bottomsheet dialog. (Everything are working, product created, productId inserted in Play Console) The problem is that: When I run app, the billing products and billingClient are ready for purchase but while purchase, bottomsheet dialog is not opening.
I tried creating multiple productIds, but it has still not working. I want to understand that, Should I publish new version of app after subscriptionIds created or without new release it is enough to use current version? (Current version contains Billing permission and dependencies)