1: 获取PackageManager 获取全部静态已安装的应用:
PackageManager pm = getPackageManager(); Listinfos = pm.getInstalledPackages(0); icon : info.applicationInfo.loadIcon(pm) appName : info.applicationInfo.loadLabel(pm)
2:获取ActivityManager获取动态所有正在运行的进程
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);Listinfos = am.getRunningAppProcesses(); info.processName + " ; " + info.uid + " ; " + info.pid
类似如下输出:
10-20 13:43:16.047: I/System.out(28009): com.qihoo360.mobilesafe:FloatWindow ; 10057 ; 27991
10-20 13:43:16.047: I/System.out(28009): com.qihoo360.mobilesafe:GuardService ; 10057 ; 2539010-20 13:43:16.047: I/System.out(28009): com.qihoo360.mobilesafe:clear ; 10057 ; 27532