I am using SOA architecture for my android application. I am running a service continuously in background (after every 1 minute) that fetches the data from my MYSQL database and synchronizes it with my SQLite database (if there is any change in 2 databases).
Now when the service runs in background it opens the SQLite. At the same time if i am handling (using) the application, it also tries to open Sqlite to fetch the data. In that case i get an error called as : Database is locked at android.database.SQLiteOpenHelper.getReadableDatabase.
Can anybody please suggest me what can be done in this kind of situation?
You need to share a single database connection between your app and the background service. This will correctly serialize all accesses to the database.