database how to - android sqlite bidirectional synchronization sqlite

1 Answers

I'd recommend to send db file to your server and do merging on the server side. Then send merged db back to the client if needed. Your solution will vary based on conflict resolve algorithm and your database schema. But here is example for the simplest case:

sqlite> attach 'client.db3' as ClientDBtoMerge;           
sqlite> insert into TableName select * from ClientDBtoMerge.TableName;
sqlite> detach database ClientDBtoMerge; 

Hope you are be able to modify example for bi-directional merge.

phone with mysql

I need to sync my Android SQLite DB with my cloud-server DB, and doing it in a bi-directional way in a multiuser environment.

I have found and introduction to the solution here but I would like to read about a better solution/algorithm.