Google-IAP
Google-IAP copied to clipboard
How to check if the user has an active subscription in Android, Google Play?
How to check if the user has an active subscription in Android, Google Play?
did you find a solution to this problem?
I personally haven't played much with subscriptions but I could look into this the coming weekend.
iapConnector?.addSubscriptionListener(
object : SubscriptionServiceListener {
override fun onSubscriptionRestored(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered upon fetching owned subscription upon initialization
//purchaseInfo.sku is the id of Subscription
}
override fun onSubscriptionPurchased(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered whenever subscription succeeded
}
override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.ProductDetails>) {
// list of available products will be received here, so you can update UI with prices if needed
}
})
//this overrided method (onSubscriptionRestored()) will fetch active subscription for you.
//This method is will fetch active subscription also working when user reinstall app.