Note: A lot of people need to fetch the package name, application name of the installed application on the device.Here is the code:
ArrayList<PackageInfo> res = new ArrayList<PackageInfo>();
PackageManager pm = ctx.getPackageManager();
List<PackageInfo> packs = pm.getInstalledPackages(0);
for(int i=0;i<packs.size();i++) {
PackageInfo p = packs.get(i);
String description = (String) p.applicationInfo.loadDescription(pm);
String label= p.applicationInfo.loadLabel(pm).toString();
String packageName = p.packageName;
String versionName = p.versionName;
String versionCode = p.versionCode;
String icon = p.applicationInfo.loadIcon(pm);
//Continue to extract other info about the app...
}
Note: Add this permission to the manifest file:
<uses-permission android:name="android.permission.GET_TASKS" />
No comments:
Post a Comment