I have this code to get a list of all apps on system:
PackageManager pm = getPackageManager();
Intent mainIntent = new Intent(Intent.ACTION_MAIN);
List<ResolveInfo> installedApps = pm.queryIntentActivities( mainIntent, 0);
for(ResolveInfo elem : installedApps) {
String PackageName = elem.activityInfo.applicationInfo.packageName;
Log.i("TAG",PackageName);
}
Run Code Online (Sandbox Code Playgroud)
But the result in installedApps shows many repeated PackageNames. Is this possible? It's 'cause a "failure" of the intent or because many apps packageNames have the same name?