Web Notifications
This code shows how to post notification to system bar using Web Notifications API.
//grant permission to post notification in config.xml
<tizen:privilege name="http://tizen.org/privilege/notification"/>
//post web notification
if (!("Notification" in window)) {
alert("Web Notifications are not supported");
} else {
var notification = new Notification("Notification Message");
}
//or you can request permissions in code directly
if (!("Notification" in window)) {
alert("Web Notifications are not supported");
}
//check permission to send notifications
else if (Notification.permission === "granted") {
//if allowed to post notification
var notification = new Notification("Hi there!");
}
//otherwise, request permission
else if (Notification.permission !== 'denied') {
Notification.requestPermission(function (permission) {
//if the user has allowed permission, then the post notification
if (permission === "granted") {
var notification = new Notification("Hi there!");
}
});
}