Enumerating all providers, and respective installed apps, in Android

Android ships with a number of content providers that store common data such as contact information, calendar information, and media files. These classes offer simplified methods of adding or retrieving data from these content providers. If you need to list all the installed providers, for debugging and other purposes, use the following code:

for (PackageInfo pack : context.getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS)) {
  ProviderInfo[] xproviders = pack.providers;
  if (xproviders != null) {
    for (ProviderInfo provider : xproviders) {
      Log.d("Providers", "provider: " + provider.name+", "+provider.processName);
      Log.d("Providers", " " + provider);
      Log.d("Providers", " app " + provider.applicationInfo);
      providers.add(mod);
    }
  }
}

device-2014-11-30-015330
Click here to download the functional demo from Google Play

 


Posted

in

by

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from try {} except

Subscribe now to keep reading and get access to the full archive.

Continue reading