I have read many examples of how to create notification messages. What i wanted to achieve, is because the notification will be executed by a widget, i would like the notifi
If you're using NotificationCompat.Builder
(a part of android.support.v4
) then simply call its object's method setAutoCancel
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setAutoCancel(true);
Some guys were reporting that setAutoCancel()
did not work for them, so you may try this way as well
builder.build().flags |= Notification.FLAG_AUTO_CANCEL;