2012-07-11 91 views
0

有没有办法获取有关设备中安装的应用程序的详细信息? 我想实现一个应用程序,它至少可以有已安装应用程序的名称。 在此先感谢。安装应用程序的Android详细信息

+1

你需要使用PackageManager – 2012-07-11 15:49:14

回答

2

可以使用PackageManager:

final PackageManager pm = getPackageManager(); 
//get a list of installed apps. 
    List<ApplicationInfo> packages = pm 
      .getInstalledApplications(PackageManager.GET_META_DATA); 

    for (ApplicationInfo packageInfo : packages) { 

     Log.d(TAG, "Installed package :" + packageInfo.packageName); 
     Log.d(TAG, "Launch Activity :" 
         + pm.getLaunchIntentForPackage(packageInfo.packageName)); 
     Log.d(TAG, "Application name :" + pm.getApplicationLabel(packageInfo)); 

    }// the getLaunchIntentForPackage returns an intent that you can use with startActivity() 

编辑:您可以使用getApplicationLabel()得到名称,如上图所示。

http://qtcstation.com/2011/02/how-to-launch-another-app-from-your-app/

+0

感谢,投了,但我需要的应用程序的名称... – 2012-07-11 19:38:57

+0

@AbdulWahab看到我的编辑。 – Tushar 2012-07-11 22:25:04

+0

不错... 我不知道,Ÿ我得到了这个职位的投票.... :( – 2012-07-12 12:35:40

0

在这里你去:

final Intent intent = new Intent(Intent.ACTION_MAIN, null); 
intent.addCategory(Intent.CATEGORY_LAUNCHER); 
final List appsList = context.getPackageManager().queryIntentActivities(intent, 0); 
相关问题