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);
}
}
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!
In reality, task killers can reduce your performance and battery life. Task killers can force apps running in the background to quit, removing them from memory. Some task killers do this automatically. However, Android can intelligently manage processes on its own – it doesn't need a task killer.
Ends one or more tasks or processes. Processes can be ended by process ID or image name. You can use the tasklist command command to determine the process ID (PID) for the process to be ended. Note. This command replaces the kill tool.
for User kill( use App switcher ): counter activity number/taskstack etc. (unspecify)for Android Framework kill(Low Memory etc): (unspecify)for Native kill(Process. kill kill signal): use native.
Force stopping an app usually solves the problem if the app is misbehaving. But you might want to reconsider before you press that button. If you're doing something important, you will likely lose your unsaved data in the app.
You do not have the rights to kill other processes; hence, killProcess()
does not work for your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With