开发者

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 开发者_如何学PythonI 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


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


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜