Android Question SQLite DB replacement

luke2012

Well-Known Member
Licensed User
Longtime User
I have to implement a procedure that replace the SQLite db file within the default Android app folder with another db file (delete current db file and copy a new db file using the same db file name).

The replamente code is simple, but how to avoid the error raised by Android when (sometimes) the App is using (locking) the db ?

- NOW
Until now, I put a user howto box that says "Before you procede please shutdown and power on your smartphone then start the procedure".
But in this way I don't have the control of the procedure and sametimes users doesn't read the disclaimer.

- POSSIBLE SOLUTIONS

Solution 1) Start the replacement procedure within the Starter Service ?
Solution 2) Before start the procedure I have to check if the db is open and close it ?
Solution 3) Close the entire App (process) and start the procedure by a service that start at system boot?
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…