Android: How to receive process signals in an activity to kill child process ?

Posted by user355993 on Stack Overflow See other posts from Stack Overflow or by user355993
Published on 2010-06-02T01:52:22Z Indexed on 2010/06/02 1:53 UTC
Read the original article Hit count: 662

Filed under:
|
|
|

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 ?

© Stack Overflow or respective owner

Related posts about android

Related posts about exec