I would like to run an async task when the app is closed out and only then. I tried putting it in the onDestroy() method but it only gets called sometimes (such as when the app is crashed). I also tried to put it on the onPause() method, but it also runs when the user tries to look at a different app rather than only when the app closes. Thanks!
Sincerely, Rocky