android save game state in onPause or onDestroy?
<p>I am trying to implement a 'resume' feature for a game I'm developing. It should work as follows:</p>

<ul>
<li><p>If the user starts a game and later closes the game with finishing, the game state is saved. When opening the app again, a 'resume' option will be available.</p></li>
<li><p>If the activity is only paused (e.g. minimized due to a phone call) and the user returns, it should show the game in progress. It should not terminate and save the state, unless of course, the OS decides to kill the activity.</p></li>
</ul>

<p>I've decided to use SharedPreferences for the most part, as well as a custom file to save extra information. I've seen a lot of people recommend saving the state of the program in the <code>onPause()</code> method and I've been wondering why this is the case. </p>

<p>From what I can gather, using <code>OnDestroy()</code> would be better. <code>onPause()</code> does not mean the activity will be killed so I could be wasting time when saving the game state necessarily. I've checked my program and <code>onDestroy()</code> is being called at the appropriate times. I'm assuming therefore I have no leak keeping the activity from being destroyed.</p>

<p>Despite this, I cannot find anywhere recommending to save state in <code>onDestroy()</code> and everyone seems to recommend using <code>onPause</code>. Am I missing a piece of information here?</p>
