Best way to do this.  Sync once a day
Question
Application Type
Mobile

Just looking for validation or suggestions on a better way to do this.

In my application I need the users to get information on their first sync of the morning.  (I have the login set to persistent because half the people using the app can hardly remember their name let alone a password)

What I have done is create a local table SyncDate with one attribute Day which is set to date.  I then put a client action in the offlinedatsync  action that reads the day from the SyncDate table.  I then have an if statement currdate() = syncdate.day.  If it is false it will update SyncDate.Day to the current date and then run the offline sync I need.  If it is true it just ends .

Is this a good way to do it on mobile?

Is OnResume the way to run this?

Thank you in advance


Andy

mvp_badge
MVP
Solution

Hi Andy,


That's what I would do with only one thing different: I would only update the sync date to the current date after getting the information from the server. This is an important detail since if getting the data for the server fails, the sync would retry on the next OnResume event. It is very important to take into account the recoverability of the device since a sync process can fail more often than expected due to network / wifi signal is not always optimal.

Sync dates are very used to this scenario and to also avoid fetching all the data in the server but only to fetch the new data since the last time the device synced.


Kind Regards,
João

Will do.  Thank you for the tip

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.