I am trying to create a mock location app. After the user chose a location, the app should spoof his location to the place he chose.
I want that when the user closes the app, from recent apps or by pressing the back button the app will stop to mock location.
After reading the docs and some debugging, I understand that the OnDestroy function does not get called when the user stop the app from recent apps.
How can I know when the user decided to kill the app?