Question

I am working on a set of novelty applications that share their fundamental behavior (picking random words from a database and combining them). Because they all work BASICALLY the same, I tried to treat the base of the code as a template of some sort, with mixed results.

As I am working on an update, I wanted to make the project a little more MVC friendly and started looking into using a ContentProvider instead of a straight SQLiteOpenHelper. I am leaning this way because Google's documentation is INCREDIBLY adamant about using them. My issue is in the realm of naming collision.

TL;DR Skip here for the question.

If two 3rd party Android applications (made by the same developer) both want to use the same ContentProvider, but not rely on another application being installed, can they both include a copy of the ContentProvider (with the same authority and everything) and be allowed to be installed at the same time (using the highest version of the ContentProvider available)?

I am not sure if this is possible with the way content providers are set up, which seems monolithic. I can't imagine Google didn't see this as a potential problem or desired feature. Yes, some complexities could arise, but we have overcome dll hell and other similarly named problems... it can't be all that difficult to do right.

Was it helpful?

Solution

I am leaning this way because Google's documentation is INCREDIBLY adamant about using them.

Not all Googlers agree with that position, let alone other schmucks like me. I only use a ContentProvider for sharing data between processes.

If two 3rd party Android applications (made by the same developer) both want to use the same ContentProvider, but not rely on another application being installed, can they both include a copy of the ContentProvider (with the same authority and everything) and be allowed to be installed at the same time (using the highest version of the ContentProvider available)?

AFAIK, the first ContentProvider registered would win, not the highest version. In fact, I'm not sure the second app will install if it attempts to redefine an existing ContentProvider.

Moreover, if the user uninstalls the current ContentProvider, the other app is screwed, since its data now goes "poof".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top