tags:

views:

219

answers:

1

Is there a way to programmatically list all available content providers on a device? No real use case, I just thought it might be neat to see what apps I have installed on my phone that have exposed content providers.

+4  A: 

It should be possible by calling PackageManager.getInstalledPackages() with GET_PROVIDERS.

EDIT: example:

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