Notification fixed at the top

2

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

    
asked by anonymous 19.06.2015 / 23:52

1 answer

2

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);
    
20.06.2015 / 19:36