How to kill an Android app and all running service/tasks from another service?
<p>I am writing an app that intercepts the launching of apps, killing them, then restarting them if certain permissions are met. I've managed to figure out the first part(launching of apps) by having a service that monitors the system log. I'm now working on killing the app that was just launched. I'm trying to use:</p>

<pre><code>ActivityManager.killBackgroundProcesses(packageName);
</code></pre>

<p>but I'm not sure if this will kill the entire app, including all services/tasks that it starts. I've tried using killBackgroundProcesses() to indiscriminately kill all apps that are launching, but the app still seems to start.</p>

<p>I've also tried android.os.Process.killProcess(pid), passing the other app's pid, however the app still seems to start as well.</p>
