Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomate closing of applications in Android
    primarykey
    data
    text
    <p>I've read a lot of documentation and other posts about closing other apps. I know the documentation says Android isn't designed that way. Android wants to hibernate an app as opposed to killing the process. That makes sense but.... I wrote an app that automatically launches other apps based on system events that the user configures. Users love it and want to close/kill those apps after subsequent system events. What I am trying to say is that users are asking me to automate this for them. That is the point of my app. It automatically launches other apps and now they want to automatically close or kill them. A lot of people say that this is not possible but it is. There are several task killer apps out there and they do the very thing I would like to do. I tried the </p> <pre><code>Process.killProcess(pid); </code></pre> <p>but that doesn't seem to do much. Reading the doco on that method it says the Linux Kernal will still enforce permissions. I even attempted to kill all processes and it didn't do anything. Perhaps I am not getting the list of processes correctly. I use the following to get a list of processes to kill</p> <pre><code>for(RunningAppProcessInfo info:activityManager.getRunningAppProcesses()){ </code></pre> <p>Then I use Process.killProcess(info.pid); to kill the process. I even tried:</p> <pre><code>activityManager.killBackgroundProcesses(String.valueOf(info.pid)); activityManager.killBackgroundProcesses(String.valueOf(info.processName)); </code></pre> <p>and then </p> <pre><code>Intent i = new Intent(); i.setComponent(new ComponentName(ProcessName, ProcessName+".Main")); context.stopService(i); </code></pre> <p>Can anyone actually answer this question and not tell me it shouldn't be done or ask why I want to do it in the first place? Please provide a code sample or something meaningful.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload