I want to call a method when the app is closed. I looked up some of the similar questions and I found
this . But the question's answer doesn't work for me. (Error didn't occur but doesn't work)
Some people refer to onStop()
or onDestroy()
but I want to call a method only when closing the app, not when closing an Activity. What is the correct way to do it?
Asked
Active
Viewed 102 times
0

Sagar Zala
- 4,854
- 9
- 34
- 62
1 Answers
1
one way is to get a list of running activities in onDestroy() of activities (or services) and call the method if there are no other activities running.

akbar_ahmad
- 63
- 6