What i understood is, you don't want the user to kill the app unless it's allowed to do so.
AFAIK, you cannot do this in any user-friendly OS. As this is the far most important feature that OS gives. Let the user decide what they intend to do.
Kindly elaborate your question further.