Android: How to create an "Ongoing" notification?
In case you are using NotificationCompat.Builder
, you can use :
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
mBuilder.setOngoing(true); //this will make ongoing notification
Assign Notification.FLAG_ONGOING_EVENT
flag to your Notification
.
Sample code:
yourNotification.flags = Notification.FLAG_ONGOING_EVENT;
// Notify...
If you aren't familiar with the Notification
API, read Creating Status Bar Notifications on Android developers website.