I created a Notification but it always compresses and goes down, I would like to keep it always expanded and always at the top of notifications
I created a Notification but it always compresses and goes down, I would like to keep it always expanded and always at the top of notifications
Just add the Notification.FLAG_ONGOING_EVENT
flag to your Notification
.
suaNotificacao.flags = Notification.FLAG_ONGOING_EVENT;
If you want to add more than one flag to your Notification
, use |=
to assign, for example:
suaNotificacao.flags |= Notification.FLAG_ONGOING_EVENT;
suaNotificacao.flags |= Notification.FLAG_SHOW_LIGHTS;
If you are using NotificationCompat.Builder
, you can use the setOngoing()
method:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
mBuilder.setOngoing(true);