有时候我们需要获取进行的PID好,好执行kill命令
ActivityManager mActivityManager = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> mRunningProcess = mActivityManager.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo amProcess : mRunningProcess) { Log.e("Application", "PID: " + amProcess.pid+ "(processName=" + amProcess.processName + "UID="+amProcess.uid+")"); }
原文:http://blog.csdn.net/shendan00/article/details/43559911