I want to kill all running applications in android. so for this task, I've implemented the following code. But it is not working. The app still remains running.
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (RunningAppProcessInfo service : manager.getRunningAppProcesses()) {
Log.i("process name " , service.processName);
android.os.Process.killProcess(service.pid);
}
So where did I make a mistake in the code?