Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getInstalledApplications vs getInstalledPackages

Tags:

android

May I know what the differences between getInstalledApplications and getInstalledPackages? The documentation doesn't say much.

like image 662
user1118764 Avatar asked Jan 04 '12 00:01

user1118764


2 Answers

  • PackageManager.getInstalledApplications(int flags) will provide you information regarding the AndroidManifest's Application tag, and just about it. Forget about activities, receivers, services and go on.
  • PackageManager.getInstalledPackages(int flags), on the other hand, will provide you information regarding all AndroidManifest's elements, such as declared activities, services, receivers, meta-data

Both methods will provide info regarding whatever application, regardless they have or they have not declared an android.intent.category.LAUNCHER intent category in some activity.

In addition, both methods will retrieve one PackageInfo/ApplicationInfo per APK, or being more specific, for package name.

like image 179
Plinio.Santos Avatar answered Nov 06 '22 06:11

Plinio.Santos


I think the term "Application" refers here to "Startable by the user" / Appears on the launcher. This means, there are a) Packages which are not executable directly (example: "DRM content", "Google Partner Setup" or "Market Updater" on my sgs2) . b) Packages which provide multiple Application. Yes you heared right. One package could have multiple Applications - two launcher entries with icons. That's possible if you mark two or more Activities in your manifest.xml as android.intent.category.LAUNCHER.

like image 43
poitroae Avatar answered Nov 06 '22 05:11

poitroae