I would say that it is definitely nice to use ContentProvider , even if you are not going to publish it.
Itβs good practice to provide an extra layer of abstraction over your data to facilitate internal change. What if you decide to change the basic structure of the database later? If you use a ContentProvider , you can contain all the structural changes inside it, where, as if you hadn't used it, you are forced to change all areas of the code that are affected by the structural changes. Itβs also nice to be able to reuse the same standard API to access data, rather than clog your code with low-level database access.
In addition, there is always the possibility that you will want to publish your data in the future. If you are not using the ContentProvider front panel, it will be much harder to update it later.
Then there are required and recommended other parts of Android, where the ContentProvider , for example, when using the SyncAdapter , and if you want an application widget that includes data access, for example.
In general, there is very little overhead when writing ContentProvider up (after you learned the API, which is a good idea), so it makes sense to do this even for private data.
Paul Drummond Mar 19 2018-12-12T00: 00Z
source share