synchronization - Up-Sync and Down-Sync in Android? -


i working on point of sale application needs syncing mechanism. have magento database.the android device have sqlite local db. need sync in following way:

local ------sync to---------------> server (up sync)

server------sync to---------------> locals (down sync)

there 2 things:

1) write-to (how take care??)

for every change on local ,it directly sync local server

2) write-back (how take care???)

whenever there change in server, need sync our locals server.

so, task is: identify server update

and sync our locals. there 4 devices running in store , have added 1 new customer through 1 device. want 3 other devices local db updated information customer , server updated.

i heard background threads , run threads after time interval. best way don't affect application. big retail stores uses syncing process. used ?

any appreciated.

it depends on database structure...

you have database in local (device) , on server

now

you need have timestamp field added tables want keep in sync.

when ever make changes on server timestamp updated there , same case local database have now.

run service in background keep on comparing timestamps of local of server.

now have put condition if timestamp of server newer of local bring changes server local,

and vice versa condition take changes local server. 

further have decide how want run service.

alternatively:

you can make table there on server store last_synched date particular device

whenever login in device (or other particular event on want perform this) server check-

  • when device last_synched
  • then compare todays date
  • and check upadets actualy happened between these dates , send changes local (device)

and vice versa local (device) server

you have play timestamps rest can have own logic how structure database.

i told have have observed, when have been part of such similar project

edit

the above process defines how sync devices server mean strategy..

if want devices notified server when sync instead of hitting web-service recurrently ..

you can make use of push notification, gcm 1 of them send push notification devices, can integrate project


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -