Skip to main content
Question

Android AppInBackground is always true

  • 11 August 2024
  • 1 reply
  • 11 views

Hello,

I’m using the latest Revenue Cat SDK (8.4.0) and i’m trying to do the following use case in Sandbox :

  • Subscribe to a monthly subscription
  • Immediately refund it from Revenue Cat dashboard
  • Open the app and see that the premium content is no longer available for the user

I’m calling

Purchases.sharedInstance.getCustomerInfoWith(fetchPolicy = CacheFetchPolicy.NOT_STALE_CACHED_OR_CURRENT) { customerInfo ->
checkStatus(customerInfo)
}

And always get this Logs :

 

Retrieving customer info with policy: NOT_STALE_CACHED_OR_CURRENT
ℹ️ Checking if cache is stale AppInBackground true
ℹ️ Vending CustomerInfo from cache.

 

Something weird here, is that AppInBackground is always returning TRUE. This means that the cache will not be stale before the 25 hours delay and never within the 5 minutes delays for foreground application. Then the cache is never updated

I’m initializing my Purchases only once in the onCreate of my Application class

if (BuildConfig.DEBUG) {    Purchases.logLevel = LogLevel.VERBOSE}Purchases.configure(PurchasesConfiguration    .Builder(this, "API_KEY")    .build())

I’ve put breakpoints in the 

PurchasesOrchestrator : 
onAppBackgrounded and onAppForegrounded

Where the appInBackground is updated, but these methods are never called

I’ve found out that the same questions was asked here : 

 But there is no solution provided

 

Thank you for your help :)

Sorry the subject has been send twice, you can close this one and answer on this one :