Skip to content

Instantly share code, notes, and snippets.

@olcayertas
Last active September 11, 2015 12:21
Show Gist options
  • Save olcayertas/c1319df65e9a13a75443 to your computer and use it in GitHub Desktop.
Save olcayertas/c1319df65e9a13a75443 to your computer and use it in GitHub Desktop.
Returns the installed application list as List<ApplicationInfo> on the device.
/**
* Returns the installed application list on the device.
* @param activity Activity.
* @return Returns List<ApplicationInfo>.
*/
public static List<ApplicationInfo> getInstalledApplicationList(Activity activity, boolean printToConsole) {
final PackageManager pm = activity.getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
if (!printToConsole) return packages;
for (ApplicationInfo packageInfo : packages) {
Log.d(Constants.LOG_TAG, "Installed package :" + packageInfo.packageName);
}
return packages;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment