Android Detect what caused the onPause
<p>I am not sure if there is a better way of doing this but I want to detect somehow what caused the application to pause.</p>

<p>On one particular activity  that displays a tracking map if the user click back or home I want to stop GPS but if the screen goes off I want to keep the gps running I am also using a wake lock so it doesn't sleep (yes I know this probably should be in a service, but that will be v2 I'm running out of time!)</p>

<p>I am overriding when the back button is pressed</p>

<pre><code>@Override
public void onBackPressed() {

    wl.release();
    this.mMyLocationOverlay.disableMyLocation();
    this.mMyLocationOverlay.disableCompass();

    if (mLocManager != null) {

        mLocManager.removeUpdates(mLocListener);
    }
    super.onBackPressed();
}  
</code></pre>

<p>but I can't find a way of doing the same for home.</p>

<p>Can anyone help?</p>

<p>Bex</p>
