Skip to main content
Question

Android checking subscription status always returns true, even when cancelled


Forum|alt.badge.img+3

Im testing in play store test mode and i activate the subscription which works fine, but when i cancel the test subscription the entitlement for the user is always returning true. On revenue cat dashboard the subscription is cancelled, so i assume this is a caching thing? If so can someone explain more deeper why it doesn’t shoot a network request to grab the updated sub value?

thanks

 

override suspend fun isSubscribed(): Flow<Boolean> = callbackFlow {    Purchases.sharedInstance.getCustomerInfo(        callback = object : ReceiveCustomerInfoCallback {            override fun onError(error: PurchasesError) {                Log.e(TAG, "onError: ${error.message}")            }            override fun onReceived(customerInfo: CustomerInfo) {                Log.d(TAG, "onReceived: ${customerInfo.entitlements["Premium"]?.isActive}")                trySend((customerInfo.entitlements["Premium"]?.isActive == true))            }        }    )    awaitClose()}
This post has been closed for comments

2 replies

Michael Fogel
Forum|alt.badge.img+6
  • Dedicated Contributor
  • 382 replies
  • May 24, 2023

Hey @tapmaxalf ,

 

This does seem to be relating to how customer info is being cached, we have a useful document explaining in more detail the caching process which can be found here: https://www.revenuecat.com/docs/caching#customerinfo

The SDK will update the cache if it's older than 5 minutes, but only if you call getCustomerInfo(), make a purchase, or restore purchases. The cache will also be updated in the background when the app restarts even if the cache is not older than 5 minutes, as well as on the app foreground after 5 minutes has passed. These background updates can be listened to with the CustomerInfo listener. See here for information on the CustomerInfo's fetchPolicy.

The latest CustomerInfo is automatically fetched and cached when the Purchases SDK is configured and throughout the lifecycle of your app, so in most cases the getCustomerInfo() method will return synchronously. It is safe to call getCustomerInfo()  as often as needed and is a good idea to call it any time a user accesses premium content.

 

I hope that helps! 


Forum|alt.badge.img+3
  • Author
  • New Member
  • 1 reply
  • June 21, 2023
Michael Fogel wrote:

Hey @tapmaxalf ,

 

This does seem to be relating to how customer info is being cached, we have a useful document explaining in more detail the caching process which can be found here: https://www.revenuecat.com/docs/caching#customerinfo

The SDK will update the cache if it's older than 5 minutes, but only if you call getCustomerInfo(), make a purchase, or restore purchases. The cache will also be updated in the background when the app restarts even if the cache is not older than 5 minutes, as well as on the app foreground after 5 minutes has passed. These background updates can be listened to with the CustomerInfo listener. See here for information on the CustomerInfo's fetchPolicy.

The latest CustomerInfo is automatically fetched and cached when the Purchases SDK is configured and throughout the lifecycle of your app, so in most cases the getCustomerInfo() method will return synchronously. It is safe to call getCustomerInfo()  as often as needed and is a good idea to call it any time a user accesses premium content.

 

I hope that helps! 

Hey Michael thank you for the details. I’m still running into this issue however, when in test mode i activated a subscription, then it was auto cancelled after like 30 mins, and still after 24 hours passed the revenue cat SDK returns the subscription as true which seems very off. Could this be just an issue in testing mode? As i havent been able to test against a real subscription yet in production


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings