Sorry, I’m asking myself again. I have solved this problem at the code level, and the solution is:
If the update, insert, and delete of ContentProvider will affect the display of the UI, then the DB cannot be directly manipulated in the code. Instead, ContentProvider should be used uniformly, and ContentObserver needs to be registered to monitor Uri in order to switch UI.
If the operation of ContentProvider does not affect the UI, then it doesn't matter. It is also possible to directly operate the DB internally.
According to the definition of ContentProvider, it is a standard API for data exchange in different applications. It can be used when an application needs to expose data to other applications, and other applications can operate the exposed data through ContentResolver and expose their own through ContentProvider. Data operation interface, other applications can perform corresponding addition, deletion, modification and query operations through this interface. But the essence of the operation through ContentResolver is to call the operation of ContentProvider, and the operation uses the db of SQLiteOpenHelper. So I personally think there is no need to rewrite it, but this is also a personal opinion. You still have to try it yourself and you will know the result.
It should be true. Data written directly through data is application private data and cannot be accessed by other applications. However, if the DB file is operated in the SD card, it seems to be accessible.
Sorry, I’m asking myself again. I have solved this problem at the code level, and the solution is:
If the update, insert, and delete of ContentProvider will affect the display of the UI, then the DB cannot be directly manipulated in the code. Instead, ContentProvider should be used uniformly, and ContentObserver needs to be registered to monitor Uri in order to switch UI.
If the operation of ContentProvider does not affect the UI, then it doesn't matter. It is also possible to directly operate the DB internally.
According to the definition of ContentProvider, it is a standard API for data exchange in different applications. It can be used when an application needs to expose data to other applications, and other applications can operate the exposed data through ContentResolver and expose their own through ContentProvider. Data operation interface, other applications can perform corresponding addition, deletion, modification and query operations through this interface. But the essence of the operation through ContentResolver is to call the operation of ContentProvider, and the operation uses the db of SQLiteOpenHelper. So I personally think there is no need to rewrite it, but this is also a personal opinion. You still have to try it yourself and you will know the result.
It should be true. Data written directly through data is application private data and cannot be accessed by other applications. However, if the DB file is operated in the SD card, it seems to be accessible.