Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add flags to a notification (status bar notification)?

im following the tutorial from developers guide but i have a problem...

tutorial says: "To clear the status bar notification when the user selects it from the Notifications window, add the "FLAG_AUTO_CANCEL" flag to your Notification object"

but... how i can add the flag to my notification?

notification doesn't have any kind of function to add flags.... then? how i can do it?

like image 657
NullPointerException Avatar asked Dec 04 '22 10:12

NullPointerException


1 Answers

Notification flags is a public member field.

Notification notif = new Notification(R.drawable.icon, shortMsg,
                System.currentTimeMillis());
notif.flags |= Notification.FLAG_AUTO_CANCEL;
like image 156
Gruntled Avatar answered Mar 23 '23 09:03

Gruntled