I've tried using both getInstalledApplications and getInstalledPackages, both seem to only give the default apps. I said only the default apps but this isn't necessarily true either. When I run the app on an AVD (api 29), it will include youtube. When I run it on my actual phone (31) it doesn't show youtube even though youtube is a default app on my phone. I'm not sure what to try from here.
This is how ive tried getting the app info.
val packManager: PackageManager = packageManager
val allPackages: MutableList<ApplicationInfo> = packManager.getInstalledApplications(PackageManager.GET_META_DATA)
//packManager.getInstalledPackages(PackageManager.GET_META_DATA)
val packages: MutableList<ApplicationInfo> = mutableListOf<ApplicationInfo>()
//getting app info for "main apps" that can actually be opened
for (i in allPackages) {
if (packManager.getLaunchIntentForPackage(i.packageName) != null) {
packages.add(packages.size, packManager.getApplicationInfo(i.packageName, 0))
}
}