MSC MSC - 2 months ago 6x
Android Question

Get number of installed apps on an Android device?

I'm making an Android launcher as an introduction to making Android apps for myself, and part of my design requires me to know how many apps are installed on a users device, and preferably count only the ones which are normal apps that can be launched. I wish to store this number of apps in a global, integer variable. With only this goal in mind, what is the simplest way of just retrieving this number as that variable?


You could use the getInstalledApplications() method of PackageManager.

From the documentation:

Return a List of all application packages that are installed on the device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all applications including those deleted with DONT_DELETE_DATA (partially installed apps with data directory) will be returned.

Something like this should work:

int numberOfInstalledApps = getPackageManager(0).getInstalledApplications().size();