Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 599
JibW Avatar asked Nov 14 '22 20:11

JibW


1 Answers

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

like image 169
Maverick Avatar answered Dec 15 '22 10:12

Maverick