How do I know my Application is being closed?
<p>I want to find a way to determine if my application is being closed/destroyed (whatever the correct term is) by the OS.  I found an <code>onCreate()</code> method in the Android <code>Application</code> class, but no <code>onDestroy()</code>, or an equivalent. (<a href="http://developer.android.com/reference/Android/app/Application.html" rel="nofollow">Application Documentation</a>)</p>

<p>While the Activity lifecycle would normally be sufficient, I have resources that take time to free up and need to be used across multiple Activities. It would be costly and unrealistic to handle those resources on any of the ending lifecycle calls of an activity (<code>onPause</code>, <code>onStop</code>, or <code>onDestroy</code>). </p>

<p>(To clarify, I do not want to programatically close my Android application. I have found plenty of documentation and SO questions on that. I am not interested in the Activity lifecycle either.) I don't care about controlling when my Application closes, but I would like a heads up when it is going to do so.</p>
