检测进程是否为系统进程

时间:2014-04-04 14:55:38

标签: android

我正在使用此方法来获取正在运行的进程

private void getRunningProcess() {
    {PackageManager pm=getActivity().getPackageManager();
    final ActivityManager manager = (ActivityManager)getActivity().getSystemService(Context.ACTIVITY_SERVICE);
    List<RunningAppProcessInfo> runningProcesses = manager.getRunningAppProcesses();
    if (runningProcesses != null && runningProcesses.size() > 0) {
    setListAdapter(new ListAdapter(getActivity(), runningProcesses));
    }
    }

我正在获取所有进程,但我只想显示非系统进程。 任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:-1)

ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);  

List<RunningAppProcessInfo> run = am.getRunningAppProcesses();  
试试吧!