We want to execute some code (reset app state) when the user leaves the app (via back or start button tap). At first we tried to override Activity.onPause() for this purpose. However, onPause is also called when the user returns from a child Activity to the main one. So the app state is reset in this case as well. No good. What is the proper way to handle the monument when the app is paused?
Is there a way to tell if onPause was called after child Activity was closed?