Last active
September 11, 2015 12:21
-
-
Save olcayertas/c1319df65e9a13a75443 to your computer and use it in GitHub Desktop.
Returns the installed application list as List<ApplicationInfo> on the device.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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