tags:

views:

47

answers:

1

I am trying to create a notification that will appear in the "ongoing" area of the notification bar (like WeatherBug).

Here is the code that I am using:

PendingIntent intent = PendingIntent.getActivity(lastContext, 0, notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT | Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR)

From what I understand, FLAG_NO_CLEAR, should also prevent the notification from being cleared by pressing the Clear button, this is also not working

Any tips SO?

+1  A: 

This is because you are using the flags in the wrong place.

You should be doing:

notification.flags |= Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR;

After you create your Notification object and before you call NotificationManager#notify

Qberticus
Thank you, that did the trick!
NPike