Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set how long a notification is displayed in android API level 10 or lower?

Research

I've been looking through the NotificationManager class in the android documentation for API level 10 and haven't found a way to implement this. I also looked around on google but only found how to set the time at which the notification is actually set and how to set the length of time a toast notification widget is displayed.


Currently Implemented

I have already set the FLAG_NO_CLEAR and FLAG_ONGOING_EVENT to keep the notification icon present as well as keep the notification visible after expanding the notification drop-down.


Attempting to Do

I am attempting to display the text of the notification in the notification bar for 10 seconds instead of the standard amount of time. So I would basically like to do exactly what the setDuration(int) function does in the toast widget.

I was wondering if this was possible and if so if someone could point me in the right direction on how to accomplish it.

like image 313
devonbleibtrey Avatar asked Oct 19 '12 13:10

devonbleibtrey


1 Answers

I am attempting to display the text of the notification in the notification bar for 10 seconds instead of the standard amount of time.

If "the text of the notification in the notification bar" means the ticker text (e.g., setTicker() on your Builder), you do not control that duration.

If "the text of the notification in the notification bar" means something in the notification drawer entry, you are welcome to cancel() your notification after a period of time.

like image 168
CommonsWare Avatar answered Sep 20 '22 16:09

CommonsWare