About android Sqlite safety in multiprocessor package

There is more than one process in my application, and in each process I need to access the same SQLite database (of course, this means more than 2 hells), so I was worried not only about the safety of SQLite threads, but also the security process.

One solution for this case is to use a content provider . But from android sdk, he warns that his methods can be called from multiple threads and therefore must be thread safe . If the content provider alone does not necessarily mean thread safety, how can I assume that it is safe in the process?

The article also explains that, by default, SQLiteDatabase synchronizes, ensuring that neither of the two threads ever touches it at the same time. What if in the case of multiple processes? Can two processes change the same table at the same time? Will it be a wreck? I don't get any response after a google search ...

+5
source share
1 answer

Several processes behave in the same way as several threads, i.e. their transactions are safe from interfering with each other.

+2
source

Source: https://habr.com/ru/post/1202209/


All Articles