安装应用程序的android详细信息

时间:2012-07-11 15:45:38

标签: android details installed-applications

有没有办法获取有关设备中安装的应用程序的详细信息? 我想实现一个至少可以包含已安装应用程序名称的应用程序。 提前谢谢。

2 个答案:

答案 0 :(得分: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/

答案 1 :(得分:0)

你走了:

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