How do I get a list of all apps in an android device,which includes the system apps,and the uninstalled apps in storage.
CodePudding user response:
You can easily get all Applications installed on a device using this code :
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);
The
pkgAppsList
has all the Apps which includes system and user apps
CodePudding user response:
You can try out different methods as suggested in this link
List<ApplicationInfo> infos = getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);
// create a list with sze of total number of apps
String[] apps = new String[infos.size()];
int i = 0;
// add all the app name in string list
for (ApplicationInfo info : infos) {
apps[i] = info.packageName;
i ;
}
Let me know if this helped you