Cancelling OngoingEvent Android Notifications
<p>I've been fighting this for over a week now, so any help would be appreciated.</p>

<p>I have an Activity starting a Service for media playback. Once playback has begun, the Service starts an Ongoing, Non-Cancellable Notification as such:</p>

<pre><code>realIntent = new Intent(this, EpisodeViewer.class);
realIntent.putExtra("show_name", showName);
realIntent.putExtra("episode_name", episodeName);

pendingIntent = PendingIntent.getActivity(this, 0, realIntent, 0);

note =
    new Notification(
        R.drawable.ic_notification_bcn,
        episodeName,
        System.currentTimeMillis());
note.flags =
    note.flags |
    Notification.FLAG_FOREGROUND_SERVICE |
    Notification.FLAG_NO_CLEAR |
    Notification.FLAG_ONGOING_EVENT;

note.setLatestEventInfo(this, "", episodeName, pendingIntent);

note.contentView =
    new RemoteViews(
        getApplicationContext().getPackageName(),
        R.layout.episode_player_note);
note.contentView.setImageViewResource(
    R.id.player_note_icon,
    R.drawable.ic_notification_bcn);
 note.contentView.setTextViewText(
    R.id.player_note_text,
    episodeName);
note.contentView.setProgressBar(
    R.id.player_note_progress, 100, 0, false);

noteManager.notify(MEDIA_PLAYER_NOTIFY_ID, note);
</code></pre>

<p>And this works just fine. When the user switches to play something else (through the Activity's UI) the Service updates the Notification (using the same as above) to change the name and re-set the progress bar. And this works just fine. And as the media progresses, the progress bar in the Notification updates, and this works as well.</p>

<p>But when the media ends or the User wants to stop, the Service tries to cancel the Notification with</p>

<pre><code>noteManager.cancel(MEDIA_PLAYER_NOTIFY_ID);
</code></pre>

<p>But this is ignored. There are no errors in the DDMS log, but from my trace I know for sure the cancel is being called. I've tried cancelling the PendingIntent before cancelling the Notification, but this makes no difference. I've also tried replacing the Notification with an 'Empty' one - clearing the progress and the name - and then cancelling. The new 'Cleared' Notification shows, but then still does not cancel.</p>

<p>So what am I missing here? Is there something else that needs to be done to cancel a FOREGROUND or NO_CLEAR or ONGOING Notification that I'm missing? I've tried this with the Emulator under 2.1 and 2.2, and on my hardware running 2.3, all of which exhibit the exact same behaviour.</p>
