Notifications
phone-glass We need more research!
The information on this page is incomplete and/or unconfirmed, and requires more research. You can help by collecting information from other resources or by testing on your own devices.

This page documents how notifications behave in KaiOS.

Creating Notifications

First, make sure your manifest file has the desktop-notification permission in it.

"permissions":{
    "desktop-notification": {"description": "notify user about stuff"},
}

Once this is in your manifest, notifications can be sent. You do not need to request permission, it will already be granted.

If you did not put the desktop-notification permission in your manifest, Notification.requestPermission() will always result in default and nothing will be shown to the user. Notifications won't work.

Options

Some options for creating notifications.

Options are passed to notifications through an object as the second parameter.

new Notification('Title goes here', {setting: "value"});
notif-how-it-looks.png

body

Body text of the notification.

icon

The icon to show alongside the notification. If this is empty or not defined it will use the application's icon, or nothing if requireInteraction is true. Only PNG files seems to work.

requireInteraction

This changes how notifications are displayed and how they behave.

If false, notifications will display as a "traditional" notification, sliding down from the top of the screen. They'll disappear on their own and be in the "Notices" list.

If true, notifications will display as kind of like a window.alert(). The user is required to dismiss them, and they won't appear in the "Notices" list.

See also

Notifications on MDN
Notifications on BananaHackers Wiki

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License