InstaSync 2-way

by Thomas Keil

Version 2 (November 19, 2017)

Download (220 downloads)

Instant 2-way synchronization of a single directory between multiple Android devices via a central server using FolderSync.
100+ Blocks

Features:
- watches for changes in the local file system and triggers FolderSync via plug-in
- implements a timeout (1 minute for now) for synchronization to save data
- sends a cloud message to your Google account on local changes
- listens to cloud messages from your Google account to trigger sync, compares md5 hashes to skip when already in sync
- listener is stopped when losing network connection and resumed when back online
- persistent settings, saved in a json file on the internal storage

Changes

v2
- add option to sync Orgzly after every sync run
- ignore short network drop-outs (wait 10 seconds before stopping listener)
- catch some possible failures
- kill all fibers when main fiber dies

Beware:
- this flow is in a working-for-me state, not to be considered stable
- FolderSync must be configured separately, for 2-way synchronization, notifications enabled (at least the one while running, the sync-finished detection relies on that)
- conflict handling is done by FolderSync
- the directory selected on first run must be identical to the directory synchronized by the FolderSync plug-in
- for now only a single directory is supported, adaption towards multiple directories should be possible
- implemented for FolderSync Lite, for the Pro version changes might be necessary

The intended use case is a single directory with multiple small text files (I use it for an Orgzly local repository). It might work with subdirectories, as long as the full hashtable fits into the cloud message payload (2kb). I synchronize with a Nextcloud server, it should work with anything compatible with FolderSync.

Feel free to comment! Suggestions for improvement are always welcome!