I am writing a Java application that talks to a C++ application using named pipes. When the C++ application dies, the Java gets SIGPIPE and the Java application dies.
On C/C++ I know how to catch that signal and ignore it. Is it possible to do something similar on Android/Java?
It seems this is not really possible. The best solution available would be to add a shut down hook and "gracefully" restart the application, as described here:
EDIT:
I needed this because (back then) I had JNI code on which I opened a FD and r/w to it. The FD was opened to a named socket (a Unix pipe), and when the remote side of the pipe (in my case a daemon, or Android C/service) closes the connection (or dies), your side will get a signal. This is not always nice. IMHO the best to handle this should be using a signal handler from good old plain-C code, and just swallow it (otherwise - you should notify the Java side of your app).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With