0

My project setup is like this

Server side

I have webserver with PHP,MySQL database apache

On android device side

I have sqlite database

I want to sync data between these two databases of device side and server side whenever there is any update in any side of database. Does android has any package to do this? Or do I need to take care of this by myself using php scripts and HttpClient api of android?

2 Answers 2

3

If you write this yourself these are some of the points to keep in mind

  • Proper authentication between the device and the Sync Server

  • A sync protocol between the device and the server. It will usually go in 3 phases, authentication, data exchange, status exchange (which operations worked and which failed)

  • Pick your payload format. I suggest SyncML based XML mixed with JSON based format to represent the actual data. So SyncML for the protocol, and JSON for the actual data being exchanged

  • Keeping track of data changes on both client and server. You can maintain a changelog of ids that change and pick them up during a sync session. Also, clear the changelog as the objects are successfully synchronized

  • Need to have a way to communicate from the server to the device to start a sync session as data changes on the server. You can use C2DM or write your own persistent tcp based communication. The tcp approach is a lot seamless

  • A way to replicate data changes across multiple devices

  • And last but not the least, a way to detect and handle conflicts

Hope this helps as a good starting point

Sign up to request clarification or add additional context in comments.

Comments

0

For the Above Purpose, you need to create web services in PHP. You can call these web services from Android side for sync purpose.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.