our Android application starts the logcat shell process and then reads its result for processing. However, when the application stops (for example, when restarting after recompilation during development), the logcat process will continue to work. Here is an example of this behavior:
processes = new ArrayList<Process>(); try { processes.add(Runtime.getRuntime().exec("logcat -v time")); processes.add(Runtime.getRuntime().exec("logcat -v time")); processes.add(Runtime.getRuntime().exec("logcat -v time")); processes.add(Runtime.getRuntime().exec("logcat -v time")); } catch (IOException e) {
Add this to the onCreate () method of the test application, start it, and then force-stop it using the settings manager. Baby processes will continue to work, now with parent id 1.
Q How to kill a logcat process initiated by an Android application? It was suggested to use ProcessBuilder, but this was not a solution, and the process would also work ..
In Stop the child process, when the parent process stops , it was suggested to use hookdown - this does not work, as shown above.
Thanks!
source share