string optional
Button icons not visible for Mac OS X users.
string
string
Additional details about this item.
string
Title of one item of a list notification.
string optional
The app icon mask is not visible for Mac OS X users.
A URL to the app icon mask. URLs have the same restrictions as iconUrl.
The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered.
NotificationButton[] optional
Text and icons for up to two notification action buttons.
string optional
Alternate notification content with a lower-weight font.
number optional
A timestamp associated with the notification, in milliseconds past the epoch (e.g. Date.now() + n
).
string optional
A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file
**Note:**This value is required for the notifications.create
()
method.
string optional
The image is not visible for Mac OS X users.
A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as iconUrl.
boolean optional
This UI hint is ignored as of Chrome 67
NotificationItem[] optional
Items for multi-item notifications. Users on Mac OS X only see the first item.
string optional
Main notification content.
**Note:**This value is required for the notifications.create
()
method.
number optional
Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. On platforms that don't support a notification center (Windows, Linux & Mac), -2 and -1 result in an error as notifications with those priorities will not be shown at all.
number optional
Current progress ranges from 0 to 100.
boolean optional
Indicates that the notification should remain visible on screen until the user activates or dismisses the notification. This defaults to false.
boolean optional
Indicates that no sounds or vibrations should be made when the notification is being shown. This defaults to false.
string optional
Title of the notification (e.g. sender name for email).
**Note:**This value is required for the notifications.create
()
method.
TemplateType optional
Which type of notification to display. Required for notifications.create
method.
"granted" "denied"
Specifies that the user has elected to show notifications from the app or extension. This is the default at install time.
Specifies that the user has elected not to show notifications from the app or extension.
"basic" "image" "list" "progress"
Contains an icon, title, message, expandedMessage, and up to two buttons.
Contains an icon, title, message, expandedMessage, image, and up to two buttons.
Contains an icon, title, message, items, and up to two buttons. Users on Mac OS X only see the first item.
Contains an icon, title, message, progress, and up to two buttons.
chrome.notifications.clear(
notificationId: string,
callback?: function,
)
Clears the specified notification.
string
The id of the notification to be cleared. This is returned by notifications.create
method.
function optional
The callback
parameter looks like: (wasCleared: boolean) => void
boolean
Promise<boolean>
Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback.
chrome.notifications.create(
notificationId?: string,
options: NotificationOptions,
callback?: function,
)
Creates and displays a notification.
string optional
Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. The identifier may not be longer than 500 characters.
The notificationId
parameter is required before Chrome 42.
Contents of the notification.
function optional
The callback
parameter looks like: (notificationId: string) => void
string
Promise<string>
Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback.
chrome.notifications.getAll(
callback?: function,
)
Retrieves all the notifications of this app or extension.
function optional
The callback
parameter looks like: (notifications: object) => void
object
Promise<object>
Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback.
chrome.notifications.getPermissionLevel(
callback?: function,
)
Retrieves whether the user has enabled notifications from this app or extension.
function optional
The callback
parameter looks like: (level: PermissionLevel) => void
Promise<PermissionLevel>
Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback.
chrome.notifications.update(
notificationId: string,
options: NotificationOptions,
callback?: function,
)
Updates an existing notification.
string
The id of the notification to be updated. This is returned by notifications.create
method.
Contents of the notification to update to.
function optional
The callback
parameter looks like: (wasUpdated: boolean) => void
boolean
Promise<boolean>
Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback.
chrome.notifications.onButtonClicked.addListener(
callback: function,
)
The user pressed a button in the notification.
function
The callback
parameter looks like: (notificationId: string, buttonIndex: number) => void
string
number
chrome.notifications.onClicked.addListener(
callback: function,
)
The user clicked in a non-button area of the notification.
function
The callback
parameter looks like: (notificationId: string) => void
string
chrome.notifications.onClosed.addListener(
callback: function,
)
The notification closed, either by the system or by user action.
function
The callback
parameter looks like: (notificationId: string, byUser: boolean) => void
string
boolean
chrome.notifications.onPermissionLevelChanged.addListener(
callback: function,
)
The user changes the permission level. As of Chrome 47, only ChromeOS has UI that dispatches this event.
function
The callback
parameter looks like: (level: PermissionLevel) => void
chrome.notifications.onShowSettings.addListener(
callback: function,
)
Custom notification settings button is no longer supported.
The user clicked on a link for the app's notification settings. As of Chrome 47, only ChromeOS has UI that dispatches this event. As of Chrome 65, that UI has been removed from ChromeOS, too.
function
The callback
parameter looks like: () => void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-15 UTC.