'How to safely add a timestamp to realm while user is offline & account for device timezone changes?
When a user answers a question on my app I want to save a timestamp to it. Then when the user connects to internet I can upload the user's progress by filtering realm for questions attempted since the last update & add it to Cloud Firestore.
Before adding the question to Firestore I compare the timestamp of the user's progress for that question if it was uploaded before & if it is newer then update & if it is older then do not update, but instead read the most recent user progress & save it to realm.
I'm thinking of this, because lets say the user changes the time in the phone or uses a different device with a different time when I want the time to be tracked the same so if an update comes from 1 phone/iPad & compared with another phone/iPad that the most recent time stamp is saved both online & to the devices.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
