Using the new chrome.notifications
API, I am unable to get notifications from my extension to appear. Even the most basic notification fails to appear for me, but I get no errors and the callback function is properly executed.
{
"name": "notify",
"version": "0.0.0",
"manifest_version": 2,
"permissions": [
"notifications"
],
"background": {
"scripts": ["main.js"]
}
}
window.addEventListener('load', function() {
var opt = {
type: 'list',
title: 'Primary Title',
message: 'Primary message to display',
priority: 1,
items: [{ title: 'Item1', message: 'This is item 1.'},
{ title: 'Item2', message: 'This is item 2.'},
{ title: 'Item3', message: 'This is item 3.'}]
};
chrome.notifications.create('notify1', opt, function() { console.log('created!'); });
});
When I inspect the background page, I can see "created!" in the console, but I don't ever get a notification on the desktop. I have tried a bunch of different priority values to no avail. What am I doing wrong?
Check your Chrome notification settings Click Settings. Select the Notifications tab. Under "Desktop notifications", click the button next to Chrome to turn notifications on or off.
You can set up Chrome to get notifications, such as meeting reminders, from websites, apps and extensions.
You may have chrome notifications blocked. A good hint this is the case is if you aren't being constantly spammed with notifications from other websites. This answer worked for me.
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