Search code examples
androidandroid-contentprovider

Have several apps managing one content provider - INSTALL_FAILED_CONFLICTING_PROVIDER


I need to have several apps using a same content provider. The first app that the user install creates the provider and adds a UUID, every other app, when installed, check if this provider already exists and use that UUID, or, if there is no other app installed before, they create the content provider with the UUID for the others app to use.

How can I achieve this, having several apps managing the same content provider without the following error generating problems for having the same authority.

INSTALL_FAILED_CONFLICTING_PROVIDER

Can I, somehow, change the provider authority and have it access the same content provider? If I change the authority and use the same url it tells me it isn't valid.

Thanks!


Solution

  • That's probably not the best way of doing it. Provider IDs are unique system wide and you really can't have more than one at a given time. But if you want to stick with it, you can read more about it here and here.

    You'll need that to access data from an app? It's best to do that using Intents or some other strategy as files, or an online database.

    You could take a look at Realm to help solve your issue.