0

How could I get all applications that were installed by user?

I want to develop an app that can present all applications that were installed by user, but

I don't understand how to get them.

use getExternalStorageDirectory()?

or is there have other method?

Marcin Koziński
  • 10,337
  • 3
  • 45
  • 60
余浩宇
  • 1
  • 1
  • I assume this is Android, by that function name? Please tag it. What you're asking is very much different on a Windows machine, or on a Mac box, or on a Symbian phone. – Amadan Jul 27 '12 at 04:54
  • 1
    perhaps reading this question- answer may help you http://stackoverflow.com/questions/2695746/how-to-get-a-list-of-installed-android-applications-and-pick-one-to-run – silent_coder14 Jul 27 '12 at 05:03

3 Answers3

0

Try This:

 final Intent intent= new Intent(Intent.ACTION_MAIN, null);
 intent.addCategory(Intent.CATEGORY_LAUNCHER);
 final List mylist= context.getPackageManager().queryIntentActivities(intent, 0);
Yash
  • 1,751
  • 13
  • 14
0

You can get all the info regarding the installed pkg:

ArrayList<PackageInfo> res = new ArrayList<PackageInfo>();
PackageManager pm = ctx.getPackageManager();
List<PackageInfo> packs = pm.getInstalledPackages(0);

for(int i=0;i<packs.size();i++) {
    PackageInfo p = packs.get(i);
    String description = (String) p.applicationInfo.loadDescription(pm);
    String  label= p.applicationInfo.loadLabel(pm).toString();
    String packageName = p.packageName;
    String versionName = p.versionName;
    String versionCode = p.versionCode;
    String icon = p.applicationInfo.loadIcon(pm);
//Continue to extract other info about the app...
}

Note: Add this permission to the manifest file:

<uses-permission android:name="android.permission.GET_TASKS" />
Vineet Shukla
  • 23,785
  • 9
  • 55
  • 64
0

You can refer to this post it does something similar... you may need to modify it a bit as it filter's out the System App's...

Community
  • 1
  • 1
Errol Dsilva
  • 177
  • 11