I need to read some data from a database, meanwhile I am loading some data into another thread with a transaction.
All of my threads for reading other tables are stopped until the transaction is completed in another thread.
I need to be able to read information from a database without worrying about another thread.
I read a lot of information about sqlite, android ... but nothing works, always my request to read parameters is blocked.
I followed these tips as @KevinGalligan says in this thread ( What are the best practices for SQLite on Android? ), Resolving locks and other issues.
1) I use only one SQLiteOpenHelper (singleton)
2) I never close the database
I tried:
start the transaction with:
database.execSQL("begin immediate transaction");
or
database.beginTransactionNonExclusive();
instead
database.beginTransaction();
It does not work, the request is blocked.
I read about WAL (database.enableWriteAheadLogging ()), but I need to support api 9.
Any other read solutions while a transaction is updating some tables? I don't care if my information is out of date, itβs more important not to block my flows.