Android: How to receive process signals in an activity to kill child process ?
- by user355993
My application calls Runtime.exec() to launch an executable in a
separate process at start up time. I would like this child process to
get killed when the parent activity exits. Now I can use onDestroy()
to handle regular cases, but not "Force quit", shutdowns from DDMS, or
kill from the console since those don't run onDestroy().
The addShutdownHandler() does not seem to be invoked in these cases
either.
Is there any other hook or signal handler that informs my activity
that it's about to get terminated ? As an alternative is there a way
to have the system automatically kill the child process when the
parent dies ?