-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Android, Windows and Chrome OS all support showing a poster image on a notification.
- Android calls this
bigPicture
:
https://developer.android.com/reference/android/app/Notification.BigPictureStyle.html
https://developer.android.com/design/patterns/notifications.html#ExpandedLayouts - Windows calls this
HeroImage
:
https://blogs.msdn.microsoft.com/tiles_and_toasts/2016/05/23/notificationsextensions-updated-for-anniversary-update-of-windows-10/#toasthero - Chrome Apps/Extensions calls this
imageUrl
:
https://developer.chrome.com/extensions/notifications#property-NotificationOptions-imageUrl
https://developer.chrome.com/apps/richNotifications
Let's add this feature to Web Notifications:
partial dictionary NotificationOptions {
USVString poster;
}
As usual, they will be displayed on a best-effort basis. For example, both Android and Windows only display the poster image when the notification is expanded (on Android, the most recent notification is usually expanded, depending on priority; in the Windows 10 Action Center, the most recent notification shown by each app is expanded [source]). Other platforms won't show them at all.
Ideally it would be possible to feature-detect platform support by checking if Notification.prototype contains poster
, but that's a subject for another issue. I will note that on Android at least, BigPictureStyle
is mutually exclusive with InboxStyle
for displaying a list of items (#21), so if we later add lists to Web Notifications we may need some way to indicate that they are mutually exclusive and/or allow web developers to indicate which property is more important, but we can cross that bridge later.