JibW
JibW

Reputation: 4562

Sync SQLite DB on android app with the remote MySQL DB

I am working on an android(Java) project where I want to update my SQLite database with a remote MySQL database info.

Initially I want to create the SQLite DB as exact remote MySQL database. After that Application normally deal with the SQLite DB.

Then when application shut down and start again if any modification happened to remote MySQL database I want to sync sqlite database with the MySQL database info.

Can anyone give any idea how I can accomplish this task. Thank you

Upvotes: 5

Views: 3384

Answers (2)

Maverick
Maverick

Reputation: 3053

You can use android service API android.app.Service for achieving this.

You just have to run a service which will check the server database changes and if there is changes get the data from the server.

But to run that service you have to write a BroadcastReceiver which will tell service to run after specified time or after application started depending upon the requirement

Upvotes: 1

0909EM
0909EM

Reputation: 5027

Use an Account Authenticator? Alternatively use a service API (See Google I/O talk on you tube http://www.youtube.com/watch?v=xHXn3Kg2IQE fast forward to 37:37)

Upvotes: 0

Related Questions