After long time, in this post i would help on retrieving the metadata about all the application installed in the mobile app. And also to retrieve all the requested permissions of each app.
You would need to use package manager to get handle of ApplicationInfo and PackageInfo class for this. In your code use the below snippet to get list of ApplicationInfo objects for all the installed applications in the device.
You would need to use package manager to get handle of ApplicationInfo and PackageInfo class for this. In your code use the below snippet to get list of ApplicationInfo objects for all the installed applications in the device.
ArrayList<ApplicationInfo> pkgAppsList = (ArrayList<ApplicationInfo>)this.getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);
Iterate the list and use loadlabel and loadicon method to get basic name of the app and icon image of the app. Refer here for list of methods in applicationinfo class.
To get the permissions each app has requested and all package metadata, get the packgeinfo object as below
PackageInfo packageInfo = context.getPackageManager().getPackageInfo("packageName", PackageManager.GET_PERMISSIONS);
PackageInfo has field requested permissions which will provide list of all permissions. Refer here for PackgeInfo fields and methods appropriate for your app.
packageInfo.requestedPermissions