我想在手机中获取所有正在运行的进程。我试过这段代码
ActivityManager am = (ActivityManager)
getBaseContext().getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> pids = am.getRunningAppProcesses();
但是这段代码只返回我的进程。
答案 0 :(得分:0)
ActivityManager am = (ActivityManager)this.getSystemService( ACTIVITY_SERVICE );
List<RunningAppProcessInfo> listProcess = am.getRunningAppProcesses();
for(RunningAppProcessInfo runningProInfo:listProcess){
Log.i("Running Processes", ":"+runningProInfo.processName);
}
工作代码。
希望这会有所帮助..