Solved

Check the subscription when the Device is off-line?

  • 10 August 2021
  • 6 replies
  • 80 views

Badge +2

This is the scenario.
I develop with Flutter.
I have a subscription that is automatically renewed monthly or annually.
My app can safely work with all the features even off-line.
Of course, to subscribe, you need to be online.
But I wonder: if after the first monthly subscription, the user always uses my app off-line (he must of course remember to put the device off-line before using it), how can I check if the subscription has been deleted?
Can there be a way?
Thanks for any suggestion.

icon

Best answer by ryan 10 August 2021, 18:01

View original

6 replies

Userlevel 4
Badge +8

You can call the .getPurchaserInfo() method the same way you would as if the device is offline. 

The latest PurchaserInfo object is cached on the device, and will always be returned first. The cache will get updated when a network connection resumes.

What this means for your customers is that the subscription status will remain the same as what it was when the device went offline.

 

how can I check if the subscription has been deleted?

You’ll need a network connection to detect any changes in the subscription that may have occurred while offline. If this is a hard requirement, then you should not allow offline usage of your app.

Badge +2

Thanks for the precise explanation.
In my application, being able to be used off-line is a feature that I would like to leave behind because it gives an extra option. However, the problem of detecting whether the subscription is still active is fundamental.
Could you give me some advice on how to solve the problem. Maybe using the property:
purchaserInfo.entitlements.all [entitlementID] ?. expirationDate

Userlevel 4
Badge +8

Unfortunately I can’t think of a way to get a 100% correct subscription status without a network connection.

You could get the expiration date of the entitlement, but you can’t be sure what is supposed to happen after that - detecting a renewal or cancellation would require a network connection. 

Also, the device date is easy to change by dimply changing the date/time on the phone so you shouldn’t do any comparisons to the device `Date()`, only a server timestamp.

Badge +2

Thanks.

Interesting thread. I was wondering whether the isActive property could be more sophisticated using the data available such as expiration date, and willRenew. Point taken the date on the device could be edited, but for 99% of people editing their device date to get free subscriptions would never be worth the trade off. 

Badge +2

I agree with you

Reply