I can successfully get the title, version and icon of an app using the code below but for some reason the description is always returned as null. Any help is appreciated.
Relevant Code:-
List<PackageInfo> packs = packageManager.getInstalledPackages(0);
for(int i=0; i < packs.size(); i++) {
PackageInfo p = packs.get(i);
// skip system apps if they shall not be included
if ((!includeSysApps) && ((a.flags & ApplicationInfo.FLAG_SYSTEM) == 1)) {
continue;
}
App app = new App();
app.setTitle(p.applicationInfo.loadLabel(packageManager).toString());
app.setPackageName(p.packageName);
app.setVersionName(p.versionName);
app.setVersionCode(p.versionCode);
CharSequence description = p.applicationInfo.loadDescription(packageManager); //error here?
app.setDescription(description != null ? description.toString() : "");
apps.add(app);
}
The App class is just a bean class that just sets the values given to it, nothing more. It is impossible that the error lies there, since I am indeed getting a "" for the description. i.e. description is coming up as null for some reason.