Stopping GPS on back button press
<p>My application uses GPS updates while it is running and I would like that to stop when the user back out of the app as I assume it will continue wasting a lot of battery power. I've tried intercepting the back button press but it doesn't seem to work. I'm not sure if this is because it's not executing the code or I'm using the wrong command. Any help would be appreciated. </p>

<pre><code>public boolean OnKeyDown(int keyCode, KeyEvent event){
    if (keyCode == KeyEvent.KEYCODE_BACK &amp;&amp; event.getRepeatCount() == 0){
    lm.removeUpdates(this);
        return true;    
    }
    return super.onKeyDown(keyCode, event);
}
</code></pre>
