I'm in an android project that performs communication through a satellite modem.
You need to run the pppd command for the modem to make the connection via android.
I performed this command through a bash.
process = Runtime.getRuntime().exec(new String[]{"su", "root", "-c", "/data/local/android_connect.sh", "&> /mnt/sdcard/Download/log.txt"});
In some moments the android creates this process with PPID = 1
When this happens I can not kill the process by executing the following command
android.os.Process.killProcess(pidProcess);
if (process != null)
process.destroy();
Is it possible to kill a process with PPID = 1 through android?
It's not a good idea, but you can try to call
Runtime.getRuntime().exec("kill -9 " + PID);
. Or try to callkillBackgroundProcesses
instead ofkillProcess
.killProcess
does not allow you to kill processes with UID that differs from your app UID, whilekillBackgroundProcesses
can do that for you.And be sure, that your app have permissions like
android.permission.ACCESS_SUPERUSER
,android.permission.KILL_BACKGROUND_PROCESSES
andandroid.permission.GET_TASKS
.