How app data syncing works

Sync is actually synchronization. Irrespective of mobiles, sync means making the data (anything) available on different platforms, different devices etc and make sure that all are having same data and there is no data loss. Sync functionality is important as it allows the app to be up-to-date with the latest data values. Generally multiple health workers create (register) patients over a single locations. In such case it is important that all the devices connected over the same location must be updated with all the patient values created by all the health workers.

 

Logic:

  1. Every time a patient or visit is been created or updated, the flag value is set to false (flag=false).

  2. As soon as the flag turns to false, the Sync function gets triggered.

  3. When the records are updated successfully, the flag is again set to true (flag=true).

  4. For offline, it will be via the following methods:

    a. Job Scheduler [Android 5 and above]

    b. Detecting n/w change [Android 4]