android.os.Process.killProcess(pid) did restart the processes again -


killprocess method kill processes why processes restart again , suppose not restarting process again. here goes code.

activitymanager manager = (activitymanager) getsystemservice(context.activity_service); list<runningappprocessinfo> services = manager.getrunningappprocesses(); (runningappprocessinfo info : services) {        int service1name = info.pid;     android.os.process.killprocess(service1name); } 

thanks concern.

actually process kill through killprocess restart process because android os assume process has been shutdown due crashing , restart again. find can use higher priority (activity manager) kill process. example can find here :

try {                  log.d("application process", "killing++");             string killcommand =                          "am force-stop com.nil.android.ssd";                 runasroot(new string[]{killcommand},true);             } catch (exception e) {                 e.printstacktrace();             }       public static void runasroot(string[] cmds, boolean shouldexit) {         try {             process p = runtime.getruntime().exec("su");             dataoutputstream os = new dataoutputstream(p.getoutputstream());             (string tmpcmd : cmds) {                 os.writebytes(tmpcmd + "\n");             }             if (shouldexit) {                 os.writebytes("exit\n");             }             os.flush();         } catch (exception ioexception) {             ioexception.printstacktrace();         }     } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -