Android has SyncAdapter to sync data intelligently, Instead of manually syncing the data, If sync adapter is implemented, mobile app just has to create new records locally. pull push and sync is done by the SyncAdapter implementation.
I used CPOrm and SyncManagerAndroid (reference) and implemented basic sync for Note DocType.
There is no visible output for sync yet. I’ve just Logged it in logcat. It works!
I wish to make it into a library which can make it easy to bring doctypes on Android.
(Java/Kotlin help anyone?)
My implementation [WIP]
3 Likes
Is the idea here to enable offline clients when API requests are not possible? If so, can this be a component of an offline desktop app that can store data locally and sync at the press of a button?
What other use cases have you thought of?
SyncAdapter framework is for Android. It’ll work on Android devices only.
Yes, SyncAdapter tries to update as soon as DB is changed, if it fails it tries again on next cycle, or 1per 24hr or when user clicks sync now. Configurable.
Not possible on desktop with Android’s SyncAdapter.
Use case,
E.g. workers (with mobile devices) log things from building basement and sync when they come above ground and Internet is available.