Search code examples
androidcontactscontractandroid-contacts

What is the recommended way to keep a list of contacts accessible only to my app?


I am building an application that needs to keep an list of contacts. That list will be built by inserting data by the user directly or by selecting from Android contacts.

But my list of contacts must not be accessible from outside my application (and will be a password protected application).

I guess I can use a SQLite database and encrypt the data. But is it somehow possible to do it on top of the Android contacts provider?

I am targeting 2.2.


Solution

  • Quoting the first sentence of the Content Providers page of the dev guide:

    Content providers store and retrieve data and make it accessible to all applications.

    The providers are actually built with accessibility in mind, which is exactly the opposite of what you want. Databases, on the other hand, are accessible exclusively by the owner app. You could, in theory, create a content provider that only provides encrypted data, but I can't see the point in doing that. Your data would be less secure and you would not get any additional advantage over a database.