1 year ago

#322622

test-img

ThN

Kotlin: How to get list of user installed apps?

I want to list all those apps installed on the phone on RecyclerView. I am using the following code, but that only lists System Apps not any of the apps installed by the user.

    private fun loadApps() {
    val packages: List<ApplicationInfo> =
        mContext.packageManager.getInstalledApplications(PackageManager.GET_META_DATA)

   for (packageInfo in packages) {

        val newApp = AppInfo()
                newApp.setAppName(getApplicationLabelByPackageName(packageInfo.packageName))
                newApp.setAppPackage(packageInfo.packageName)
                newApp.setAppIcon(getAppIconByPackageName(packageInfo.packageName))
                myApps.add(newApp)
       }
    }

I have looked high and low on StackOverflow and on the Internet, but so far nothing seems to help solve my issue. So, how do you get a list of the INSTALLED user apps not the system? The above code suppose to list all the apps on your phone, but it seems not to. thanks.

android

kotlin

android-recyclerview

smartphone

0 Answers

Your Answer

Accepted video resources