Multiple databases and content providers

android, android-contentprovider, database, sqlite

Solution

As so often: It depends :-)

But if you must use multiple databases, chances are that those contain more or less unrelated data. In this case I would use a different ContentProvider for each database. That's a clear separation on concerns and makes the API easier to understand.

BTW: Keep security in mind. Use signature access level for the permissions if you only want your apps to use the data!

Problem

In my app I have multiple sqlite databases which are all exported through a content provider for my other apps to be able to read the data. Is it better to have a single content provider containing all my databases, or a content provider for each database? My other apps will only require access to one database at a time. N.B. I have read similar posts, and my app MUST be able to have multiple databases.

Original source