-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
I have been using the RevenutCat SDK for more than 2 years in my Android app. After upgrading the RevenueCat Android SDK from 8.x.x to 9.1.1, the restore purchase functionality has stoped working in my app and many of the users are complaining regarding the same. After upgrading the SDK version, I haven't made any code changes in the Restore Purchase functionality.
You can find the code that I am using below.
fun restorePurchase(): Flow<PlanPurchaseState> {
return callbackFlow {
trySend(PlanPurchaseState.PurchaseInProgress)
Purchases.sharedInstance.restorePurchasesWith(onError = { error: PurchasesError ->
trySend(PlanPurchaseState.PurchaseError(error.message))
close()
}, onSuccess = { customerInfo ->
val entitlementInfo =
customerInfo.entitlements.all.values.firstOrNull { it.isActive }
if (entitlementInfo == null) { // No previous purchase found
trySend(PlanPurchaseState.PurchaseError(context.getString(R.string.premium_plans_error_no_earlier_purchases)))
} else {
trySend(PlanPurchaseState.PurchaseSuccess(currentActivePlan))
}
close()
})
// Waits for the function to get finished and is only called after the close() function is invoked
awaitClose()
}
}When the above code is executed, I am getting entitlementInfo null every time even though a purchase was made earlier. Any help will be appreciated.
- Platform: Android
- SDK version: 9.1.1
- OS version: Android 16
- Android Studio version: Narhwal 2025.1.1 Patch 1
- How widespread is the issue. 100% devices affected.
fanwgwg and pauledwardtang
Metadata
Metadata
Assignees
Labels
No labels