We've got a Chrome app with working notifications, but the notification only lasts a few seconds and then goes away. Our end users are going to want that notification to stay until they dismiss it. Can that be done? We couldn't find anything in the API documentation regarding notification duration.
Since Chrome 50, you can make a notification persist until dismissed with requireInteraction
flag:
Indicates that the notification should remain visible on screen until the user activates or dismisses the notification. This defaults to false.
You can't make a chrome.notifications
notification last forever.
You can sort of control the duration with the priority
parameter. From the relevant article (not the main documentation):
Notifications can be assigned a priority between -2 to 2. Priorities < 0 are only shown in the center; priorities > 0 are shown for increasing duration and more high priority notifications can be displayed in the system tray.
Note: if you call update
changing the notification's priority, it will be re-shown as needed. You can, in principle, try to exploit that to stay visible.
If you do not need features provided by Rich Notifications, you can use web standard Notification
API.
They look similar in Chrome, but do not integrate with the Message Center. As such, they do not disappear unless dismissed by user or programmatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With