本文介绍了Android的任务杀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要杀死,在Android的类似任务的杀手运行所有任务...现在做什么我做了,直到为:

I want to kill all tasks that run in android like task killer...What I have done until now is:

ActivityManager manager =  (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
    List<RunningAppProcessInfo> activityes = ((ActivityManager) manager).getRunningAppProcesses();

    for (int i = 0; i < activityes.size(); i++){

        Log.e("APP: "+i, activityes.get(0).processName);

        if (!activityes.get(0).processName.equals("app.android.myapp")){
            Process.killProcess(activityes.get(0).pid);
        }

    }

与code的问题是,它返回的activityes仅列出我的应用程序的12倍。而没有任务被打死...

The problem with the code is that it returns in the activityes list only my app for 12 times. And no task is being killed...

有人可以帮我吗?谢谢!

Can somebody help me please?Thank you!

推荐答案

您不必杀死其他进程的权利;因此, killProcess()不适合你的应用程序工作。

You do not have the rights to kill other processes; hence, killProcess() does not work for your app.

这篇关于Android的任务杀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 02:42