Orientation change and Notification
<p>I want to implement the following scenario:</p>

<p>When a user presses the Home key a Notification is displayed in the Status bar and the App is normally hidden. When user taps the Notification App is normally restored.</p>

<p>Here is my code for this:</p>

<pre><code>private int NOTIFICATION = R.string.local_service_started;
private NotificationManager mNM;

private void showNotification() {
    CharSequence text = getText(R.string.local_service_started);
    Notification notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, JingleCartoucheActivity.class), 0);
    notification.setLatestEventInfo(this, getText(R.string.local_service_label), text, contentIntent);
    mNM.notify(NOTIFICATION, notification);
}

@Override
public void onPause() {
    super.onPause();
    if (!isFinishing()) {
        showNotification();
    }
}

@Override
public void onResume() {
    super.onResume();
    mNM.cancel(NOTIFICATION);
}
</code></pre>

<p>All of this is working well except for one thing: </p>

<p>When the App is run and the user rotates the phone, the notification is created and immediately destroyed. Is there a way to detect the phone orientation change in onPause() and not show this Notification? </p>
