I am developing a set of apps that are distinguished only in certain brandings (think different sports teams); however, I am running into a problem where I am using one Library project for all of the specifically branded apps and want to use the same ContentProvider for all of them. When I created the ContentProvider I declared the AUTHORITY as a constant in the class (per the dev example code) and I am using the same authority in every specific app in the manifest files. It looks like I can't use the same authority across every app as I get this error when trying to install a second app (I install one branded one just fine but the second install):
WARN/PackageManager(66): Can't install because provider name com.xxx.Provider (in package com.xxx) is already used by com.zzz
I've tried several approaches but none of them seem to work. One idea that I haven't done yet, was to create a library jar and just omit the Provider class I have and customize it in each specific app. Any ideas on how to get around this problem without resorting to that?
ContentProviders are identified by the authority, so it needs to be unique. I don't think there are any tricks around that.
Additionally, there's a bug in the Android platform that also prevents using the same classname for two different ContentProviders, even if they have different authority and are contained in separate APKs. See the bug here.
The solution I advise for you is to create the abstract provider class in your library project, and then extend it with a unique name in each of the individual applications. To make this practical you will probably need to create a script to generate/modify the individual manifests and contentprovider classes.
Hope this helps.