Currently we're doing continuous two-way synching which is great from a simplicity point-of-view but pretty bad in terms of battery and network usage.
So, normally just do a synch from remote to local and only do this on startup and every 5 minutes or so.
If the user makes local changes to the database immediately save something in localstorage to say there are outstanding local changes and try to sync local -> remote. If that synch works remove the flag in localstorage. On the normal synch that occurs every 5 minutes or so check if the flag is set in localstorage. If there are outstanding changes then try a two-way synch.
Currently we're doing continuous two-way synching which is great from a simplicity point-of-view but pretty bad in terms of battery and network usage.
So, normally just do a synch from remote to local and only do this on startup and every 5 minutes or so.
If the user makes local changes to the database immediately save something in localstorage to say there are outstanding local changes and try to sync local -> remote. If that synch works remove the flag in localstorage. On the normal synch that occurs every 5 minutes or so check if the flag is set in localstorage. If there are outstanding changes then try a two-way synch.