I am trying to extract all exported content providers from installed application using the following code. But for every application, this returns zero. Though, when I check the same with ADB, the application lists all exposed content providers and their URIs. Do I need any permission to extract? Could someone please guide me on this? I am quite new to android.
List<ProviderInfo> returnList = new ArrayList<ProviderInfo>();
ProviderInfo[] prov = getPackageManager().getPackageInfo(packageName, 0).providers;
if (prov != null)
{
returnList.addAll(Arrays.asList(prov));
}
int count1 = returnList.size();