I'm developing a Chrome extension, and in my case, i want to show a notification. Although i set priority is 2, but it just show 20 seconds then disappear. Do you have any way to increase time show notification ?
Asked
Active
Viewed 105 times
0
-
Use [requireInteraction](https://developer.chrome.com/extensions/notifications#type-NotificationOptions) option: [Prevent chrome.notifications API from hiding my notification after a few seconds](//stackoverflow.com/q/20326926) – wOxxOm Mar 01 '17 at 09:31
-
Thanks wOxxOm, that exactly what i want. – MrBac Mar 01 '17 at 09:45
1 Answers
0
Like wOxxOm comment, we can use requireInteraction to increase time show notification.
Indicates that the notification should remain visible on screen until the user activates or dismisses the notification. This defaults to false.
Example :
chrome.notifications.create(warningId,
{
iconUrl: chrome.runtime.getURL('images/icon-48.png'),
title: data.word.toUpperCase(),
type: 'basic',
message: "Test message",
buttons: [{ title: 'Close' }],
isClickable: true,
priority: 2,
requireInteraction: true
},
function() {});

MrBac
- 17
- 5