1

Hey, can anyone give me an idea on how syncing works?
(Been searching for past few hours, didn't went past some weird advance server admins stuff or cloud backup ads.)

All i wish to do is to make a service for my app that will run every night and upload/delete /modify (basically , sync) my app's local database to the server.

Just gimme a rough idea on the algorithm to use, i have done till running the service every night( but what exactly it should do, i have no idea)

Comments
  • 0
    @NoMad Ok a lot of unknown words like cronjob and ssh here. would google them but lemme clear more of my thoughts.

    there is this feature called service which i could use with another feature called workscheduler. Together, these guys don't care weather the app is open or not.
    they will just access the a copy of local db at that time and could simply upload it to server. Similarly they can access the copy on cloud whenever they want .

    Suppose on day 1, user added 5 entries. On night 1, it should add those 5 entries.

    On day 2 user modified 1 entry and deleted 3., On night 2, those 3 entries should be deleted and 1 entry should be modified( in cloud)

    How can i make this syncing work?
  • 0
    Add the db to their gdrive or icloud.
  • 0
    @TitanLannister you are missing a lot of details here....
    two approaches:
    KISS: backup the full db to the server. just upload the whole thing. pros: dumb af. just works. cons: large server data costs.
    just make sure you keep 10 history files.

    incrementaly dumb: send a metadata json from client to server. each item is marked as add/del with record id as identification. pros: will work. a bit complicated to implement. low server costs. cons: has some issues with correct event sequence when adding/deleting.

    remeber to piggyback on other apps wakelock, and make sure you have power and wifi before uploading large stuff.

    tl;dr: why not use a SyncProvider ffs?
Add Comment