Looked at android documentation and it appears that we don't have the ability to know when an app shuts down. Whether it was explicitly by the user or automatically by the operating system.
Below is the onTerminate()
documentation which is only available in the emulated scenario.
public void onTerminate()
Since: API Level 1
This method is for use in emulated process environments. It will never be called on a production Android device, where processes are removed by simply killing them; no user code (including this callback) is executed when doing so.
Does anyone have any other approaches to report back when the user closes the application?
We need to know from a pilot/usability standpoint if we need to incorporate additional functionality into our future production app.
Not sure whether this is going to help you...
In my app, I'm using Activity.onDestroy() to do the cleanup that I need. I have a couple of activities - and have onDestroy()
in each of them.
This is the closest I got to doing what I needed - and it actually works quite well.