How to use the same authority ContentProvider in free and paid versions of the application?

I started using Android Library Projects to consolidate my paid and free version code.

I am having a problem though with my ContentProvider. Since the ContentProvider is defined in the library class, both applications use the same authority. This means that the android prevents the installation of the second application (in any order) due to the INSTALL_FAILED_CONFLICTING_PROVIDER error.

05-22 11:14:40.563: WARN/PackageManager(102): Can't install because provider name com.cfms.android.podcast (in package com.cfms.android.podcastlite) is already used by com.cfms.android.podcastpaid 05-22 11:14:40.563: WARN/PackageManager(102): Package couldn't be installed in /data/app/com.cfms.android.podcastlite-2.apk 

How can I deal with this problem? Ideally, I would like the authorities to be the same for each version of the application, so I do not need to insert a bunch of exceptions into the shared code library. If this is not possible, how should I go next?

+6
source share
2 answers

It is simply not possible to have two applications on the same device with different vendors using the same authority.

http://hustleplay.wordpress.com/2010/02/28/android-install_failed_conflicting_provider/

credential provider for duplicate android .

I would create a different string resource in each application, which is then passed to the library to create a provider with the appropriate privileges.

+6
source

Could you try something like this?

http://ncsoftworks.com/forums/discussion/6/sharedpreferences-between-applications

Also, is not the authority of the content provider just the name of the private embedded Linux directory? And isn't the content provider just a SQLite database file inside this private folder?

And can we not use the same folder between applications while we sign both applications with the same key and the same application package name, thereby creating a common user ID?

In any case, I'm just thinking about it at the moment. I will have to experiment with this. I just post this to save some time in case someone finds an error in my assumptions (before I have time to conduct the experiment).

Note. I said the name of the application package, not the name of the package. As far as I understand, Android applications usually contain two package names (although the Eclipse New project wizard usually lists both packages with the same name, giving the impression that there is only one package name)

0
source

Source: https://habr.com/ru/post/888768/


All Articles