如何获得正在运行的应用程序包?我设法得到了名字,但找不到如何得到包。这是我的代码。
ActivityManager am = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
List list = am.getRunningAppProcesses();
Iterator iter = list.iterator();
PackageManager pm = this.getPackageManager();
while(iter.hasNext()) {
ActivityManager.RunningAppProcessInfo info = (ActivityManager.RunningAppProcessInfo)(iter.next());
try {
CharSequence c = pm.getApplicationLabel(pm.getApplicationInfo(info.processName, PackageManager.GET_META_DATA));
Log.w("APPS", c.toString());
}catch(Exception e) { }
}catch(Exception e) { }
}
由于