Search code examples
androidandroid-contentproviderandroid-contentresolver

How to get list of content providers for all users on a tablet


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.


Solution

  • 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