quill
quill copied to clipboard
Allow syncing in the background
Until this is implemented, there will always exist a high possibility of bugs like this:
- User makes significant edits to a post
- A phone call comes in, app goes to background, edits are saved but not synced to the server
- User does not open the app for several days
- In that period, someone else (or this same user) makes some edits to the same post through the web interface -- at this point the user may notice their several days old edits have not appeared yet!
- Now the user opens the app and a sync occurs -- this will end up overwriting the remote copy with edits in step 4 with the old edits!
Concerns to take care of:
- [ ] Ensure background service starts automatically on boot using
ACTION_BOOT_COMPLETED
This sample offline architecture may help (presented at the Android Dev Summit architecture talk): https://github.com/yigit/dev-summit-architecture-demo
Removed from 1.0 as this is a pretty big change.
GCM Network Manager looks like the best way to do this: it's convenient, flexible and conserves battery. Here's a great overview: https://www.bignerdranch.com/blog/optimize-battery-life-with-androids-gcm-network-manager/
It should be noted that with GCM moving over to Firebase, the GCM Network Manager will eventually be superseded by Firebase Job Dispatcher.
UPDATE: Yigit Boyar's Priority JobQueue library might also be helpful.