2π
β
Yes, you should save the time when the user leaves the app.
When they return (so, whenever you fetch data from the database), compare the saved time to the current time and apply whatever operations need to happen based on the difference.
Alternatively, you could have a server always running and deal with scheduled jobs and the like to keep it all updated in realtime, but lazy evaluation that only happens when the user requests the data should suffice for this case.
π€Matt
Source:stackexchange.com