tags:

views:

329

answers:

1

From the documentation for android.app.Application:

"Base class for those who need to maintain global application state"

I am using my own subclass to maintain an object that I'm using to query a server. Also from the documentation:

"onTerminate() Called when the application is stopping."

However, onTerminate() in my class is never called. I press the back button while viewing my main activity, and everything seems to shut down. My main Activity's onDestroy() method is called and isFinishing() returns true, but my android.app.Application's onTerminate() method is never called.

Why is this? What am I missing? Is there something that is keeping it open?

+2  A: 

This might be related to the fact that although you exit the application, the process for it is still running in the background so that restarting the application would use the same process.

Also the javadocs states not to rely on the onTerminate code to be called.

Note: never depend on this method being called; in many cases an unneeded application process will simply be killed by the kernel without executing any application code.

Soulreaper