Tips for when to sync off line data


We are building an app with Ionic that will work offline and when user input some data, it will have to sync with our servers.
My main concern is about the “when” to sync. When the user make some main actions (accept a task, pack an item, etc) I will try to sync that action to our servers. If not, will queue for latter sync. Then comes the problem: when the user pauses the app. Supose the user make some main action, no connection, so queue the sync. Then the user pauses the app and go for vacation (ok, extreme case here!). The data will not be synced.

Is there any tip, plugin, resource to help me?


Ps: I already seen some plugins to keep the app running but some are not accepted for some stores or requires writing specific code for each platform.

If there’s no connection and they don’t use the app for a while then I don’t think there’s anything you can do. I’m working on an app that has similar sync requirements, and for my use case that’s fine, it’s nothing super important, that data just won’t show up on other instances of the app they’re logged into. If it’s data that needs to be synced for some day-to-day operations in an important workflow then perhaps you can simply do some reminders. Throw up an alert/toast/notification if the data can’t sync immediately. That way the end user is at least aware that it needs to connect, and can take care of that before they go on vacation or something.

@beck24 thanks for your tip.
I think this will be one of our strategies. At each main action we’ll try to send the data and if cannot do it notify the user.
A times, using $interval, check if there is any pending data and send a notification in the case the user finished a client and is doing other tasks on the app.

We are thinking of when cannot conenct, do not try to connect for the next few minutes or actions, so the user do not experience the timeout every action. After that, go back to normal operation trying to conenct.