getInstalledPackages() for Android multiple users

517 views Asked by At

I want to get a list of all apps installed on my device. My code is below: PackageManager pm = getApplicationContext().getPackageManager(); List<PackageInfo> list = pm.getInstalledPackages(0);

When I try multiple user registered on my device (i.e. Android for Work), the API returns a list from the same user space/managed profile, which makes sense.

My question is, is there an option to get a list of all apps from the device (like Settings - Apps - All apps), no matter where the app is installed?

1

There are 1 answers

0
Rikka On

Use LauncherApps (only can get apps will shown in launcher), you can see how Launcher3 use it https://developer.android.com/reference/android/content/pm/LauncherApps.html