3

I can get list of Content Providers for logged-in users on a tablet using this code:

for (PackageInfo pack : getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS)) {
    ProviderInfo[] providers = pack.providers;
    if (providers != null) {
        for (ProviderInfo provider : providers) {
            Log.d(TAG, "provider info: " + provider.authority);
        }
    }
}

But, this code above doesn't list ALL the Content Providers available on devices including other users and restricted profiles.

My Question: Is it possible to list content providers for all the users/profiles on a tablet ?

I see other questions on SO about this, but they only list content providers for logged in user only.

Community
  • 1
  • 1
bianca
  • 7,004
  • 12
  • 43
  • 58
  • It is a common sense to be able to get data only for logged in user. Otherwise, it would be a security breach. – Jehy Jun 06 '16 at 12:33
  • What if I want to write a content provider that's available to all users on a tablet. Is it possible to define such cp at all ? – bianca Jun 06 '16 at 13:52
  • I think that then each user will have to launch your application separately. – Jehy Jun 06 '16 at 14:58
  • @Jehy Not sure if I understood correctly. I want to right a shared CP that I want to be accessible across my apps across all users on a table. Is it possible at all ? – bianca Jun 06 '16 at 17:35
  • Try this answer : http://stackoverflow.com/a/5302610/1727132 - it does not try to get all installed packages so it could possibly work... If not, then this is impossible. – Jehy Jun 07 '16 at 05:25
  • @Jehy: I tried other approaches in the link as well. I found out that its impossible for a content provider to provide data across system-users on a tablet. Thanks for you help ! – bianca Jun 10 '16 at 17:04
  • @bianca, from your comment, it seems that you have determined that what you want to do is not possible. Could you post an answer to your question documenting what you have found? I am sure that others would appreciate it. – Richard Chambers Jun 11 '16 at 13:46

1 Answers1

0

After researching and trying out all possible options (including reference in this post), I figured out that its not possible to write a Content Provider which can share data across multiple users and restricted profiles on a tablet

bianca
  • 7,004
  • 12
  • 43
  • 58