In short, no, onDestroy() not called, and you cannot do this. Android does not support it.
More extended answer ...
onDestroy() does not seem to be called in this script. I tested this by trying to use its Toast for me before calling super.onDestroy, but the Toast message never appeared. (And according to this post , onDestroy() really unreliable and will not be called often, if at all, on phones, whereas it can be called on the emulator - so keep that in mind). Instead, killProcess() is called, and we cannot intercept it.
In addition, in accordance with the accepted answer in this message , it seems that we cannot even catch and perform tasks after stopping the forced stop of the user.
Mxyk
source share