For more information on the Notification features, see Notification Guide.
Since: 2.0
Interface | Method |
---|---|
NotificationObject | |
NotificationManager | void post (Notification notification) void update (Notification notification) void remove (NotificationId id) void removeAll () Notification get (NotificationId id) Notification[] getAll () |
Notification | |
StatusNotificationInit | |
StatusNotification | |
NotificationDetailInfo |
enum NotificationType { "STATUS" };
Since: 2.0
The following notification type is supported:
enum StatusNotificationType { "SIMPLE", "THUMBNAIL", "ONGOING", "PROGRESS" };
Since: 2.0
The following status notification types are supported:
[NoInterfaceObject] interface NotificationObject { readonly attribute NotificationManager notification; };
Tizen implements NotificationObject;
Since: 2.0
The tizen.notification object allows access to the Notification API.
[NoInterfaceObject] interface NotificationManager { void post(Notification notification) raises(WebAPIException); void update(Notification notification) raises(WebAPIException); void remove(NotificationId id) raises(WebAPIException); void removeAll() raises(WebAPIException); Notification get(NotificationId id) raises(WebAPIException); Notification[] getAll() raises(WebAPIException); };
Since: 2.0
The NotificationManager interface provides access to the notification object.
post
void post(Notification notification);
Since: 2.0
Privilege level: public
Privilege: http://tizen.org/privilege/notification
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
try { var appControl = new tizen.ApplicationControl( "http://tizen.org/appcontrol/operation/create_content", null, "image/jpg", null); var notificationDict = { content : "This is a simple notification.", iconPath : "images/image1.jpg", soundPath : "music/Over the horizon.mp3", vibration : true, appControl : appControl}; var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict); tizen.notification.post(notification); } catch (err) { console.log (err.name + ": " + err.message); }
update
void update(Notification notification);
Since: 2.0
Privilege level: public
Privilege: http://tizen.org/privilege/notification
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
try { // Uses a variable for the previously posted notification. notification.content = "My notification"; tizen.notification.update(notification); } catch (err) { console.log (err.name + ": " + err.message); }
remove
void remove(NotificationId id);
Since: 2.0
Privilege level: public
Privilege: http://tizen.org/privilege/notification
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type NotFoundError, if NotificationId is not found in the previously posted notification.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
try { // Uses a variable for the previously posted notification. tizen.notification.remove(notification.id); } catch (err) { console.log (err.name + ": " + err.message); }
removeAll
void removeAll();
Since: 2.0
Privilege level: public
Privilege: http://tizen.org/privilege/notification
Exceptions:
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
try { tizen.notification.removeAll(); } catch (err) { console.log (err.name + ": " + err.message); }
get
Notification get(NotificationId id);
Since: 2.0
Parameters:
Exceptions:
with error type NotFoundError, if NotificationId is not found in the previously posted notifications.
with error type UnknownError, if any other error occurs.
Code example:
try { // Uses a variable for the previously posted notification // Saves the notification ID for future use var myId = notification.id; var myNotification = tizen.notification.get(myId); } catch (err) { console.log (err.name + ": " + err.message); }
getAll
Notification[] getAll();
Since: 2.0
Exceptions:
with error type UnknownError, if any other error occurs.
Code example:
try { var notifications = tizen.notification.getAll(); var index = 0; for ( index = 0; index < notifications.length; index++ ) { console.log(notifications[index].id); console.log(notifications[index].title); console.log(notifications[index].statusType); console.log(notifications[index].type); console.log(notifications[index].content); console.log(notifications[index].postedTime); console.log(notifications[index].iconPath); console.log(notifications[index].soundPath); console.log(notifications[index].vibration); console.log(notifications[index].appControl); } } catch (err) { console.log (err.name + ": " + err.message); }
[NoInterfaceObject] interface Notification { readonly attribute NotificationId id; readonly attribute NotificationType type; readonly attribute Date postedTime; attribute DOMString title; attribute DOMString? content; };
Since: 2.0
Since: 2.0
Since: 2.0
Since: 2.0
Since: 2.0
Since: 2.0
dictionary StatusNotificationInit { DOMString? content; DOMString? iconPath; DOMString? soundPath; boolean? vibration; ApplicationControl? appControl; ApplicationId? appId; NotificationProgressType? progressType; unsigned long? progressValue; long? number; DOMString? subIconPath; NotificationDetailInfo[]? detailInfo; DOMString? ledColor; unsigned long ledOnPeriod; unsigned long ledOffPeriod; DOMString? backgroundImagePath; DOMString[]? thumbnails; };
Since: 2.0
[Constructor(StatusNotificationType statusType, DOMString title, optional StatusNotificationInit? notificationInitDict)] interface StatusNotification : Notification { readonly attribute StatusNotificationType statusType; attribute DOMString? iconPath; attribute DOMString? subIconPath; attribute long? number; attribute NotificationDetailInfo[]? detailInfo; attribute DOMString? ledColor; attribute unsigned long ledOnPeriod; attribute unsigned long ledOffPeriod; attribute DOMString? backgroundImagePath; attribute DOMString[]? thumbnails; attribute DOMString? soundPath; attribute boolean vibration; attribute ApplicationControl? appControl; attribute ApplicationId? appId; attribute NotificationProgressType progressType; attribute unsigned long? progressValue; };
Since: 2.0
All notifications must have a title attribute.
StatusNotification(StatusNotificationType statusType, DOMString title, optional StatusNotificationInit? notificationInitDict);
Since: 2.0
Since: 2.0
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.2
Code example:
try { var notificationDict = { content : "This is a simple notification.", iconPath : "images/image1.jpg", soundPath : "music/Over the horizon.mp3", vibration : true, ledColor : "#FFFF00", ledOnPeriod: 1000, ledOffPeriod : 500 }; var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict); tizen.notification.post(notification); } catch (err) { console.log (err.name + ": " + err.message); }
Since: 2.2
Since: 2.2
Since: 2.1
Since: 2.1
Since: 2.0
Since: 2.0
Since: 2.0
Since: 2.0
Code example:
try { // Gets the current application information with tizen.application.getAppInfo var myappInfo = tizen.application.getAppInfo(); var notificationDict = { content : "This is a simple notification.", iconPath : "images/image1.jpg", soundPath : "music/Over the horizon.mp3", vibration : true, appId : myappInfo.id }; var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict); tizen.notification.post(notification); } catch (err) { console.log (err.name + ": " + err.message); }
Since: 2.1
If progressValue is set, the progressbar will be displayed in the notification. The progressValue can change the amount of progress as it moves forward or backward. It gets the progress value of the current notification. If 0, the indeterminate progressbar will be shown. This attribute is only available for StatusNotification of type PROGRESS.
Applications should keep the progress value for its job because the saved value in the notification status tray would be different from the exact progress value.
Range of progressValue: percent (0 to 100).
Since: 2.0
Code example:
try { var appControl = new tizen.ApplicationControl( "http://tizen.org/appcontrol/operation/create_content", null, "image/jpg", null); var notificationDict = { content : "This is a progress notificaiton.", iconPath : "images/image2.jpg", soundPath : "music/Over the horizon.mp3", vibration : true, appControl : appControl, progressValue : 20}; // Constructs the progress notification var notification = new tizen.StatusNotification("PROGRESS", "Progress notification", notificationDict); // Posts the notification tizen.notification.post(notification); // Updates the progress value of the notification notification.progressValue = 59; tizen.notification.update(notification); } catch (err) { console.log (err.name + ": " + err.message); }
[Constructor(DOMString mainText, optional DOMString? subText)] interface NotificationDetailInfo { attribute DOMString mainText; attribute DOMString? subText; };
Since: 2.1
Code example:
var detailInfo1 = new tizen.NotificationDetailInfo('Missed Call from James', 'Feb 11 2013'); notification.detailInfo = [detailInfo1];
NotificationDetailInfo(DOMString mainText, optional DOMString? subText);
Since: 2.1
By default, this attribute is set to null.
Since: 2.1
module Notification { typedef DOMString NotificationId; enum NotificationType { "STATUS" }; enum StatusNotificationType { "SIMPLE", "THUMBNAIL", "ONGOING", "PROGRESS" }; enum NotificationProgressType { "PERCENTAGE", "BYTE" }; [NoInterfaceObject] interface NotificationObject { readonly attribute NotificationManager notification; }; Tizen implements NotificationObject; [NoInterfaceObject] interface NotificationManager { void post(Notification notification) raises(WebAPIException); void update(Notification notification) raises(WebAPIException); void remove(NotificationId id) raises(WebAPIException); void removeAll() raises(WebAPIException); Notification get(NotificationId id) raises(WebAPIException); Notification[] getAll() raises(WebAPIException); }; [NoInterfaceObject] interface Notification { readonly attribute NotificationId id; readonly attribute NotificationType type; readonly attribute Date postedTime; attribute DOMString title; attribute DOMString? content; }; dictionary StatusNotificationInit { DOMString? content; DOMString? iconPath; DOMString? soundPath; boolean? vibration; ApplicationControl? appControl; ApplicationId? appId; NotificationProgressType? progressType; unsigned long? progressValue; long? number; DOMString? subIconPath; NotificationDetailInfo[]? detailInfo; DOMString? ledColor; unsigned long ledOnPeriod; unsigned long ledOffPeriod; DOMString? backgroundImagePath; DOMString[]? thumbnails; }; [Constructor(StatusNotificationType statusType, DOMString title, optional StatusNotificationInit? notificationInitDict)] interface StatusNotification : Notification { readonly attribute StatusNotificationType statusType; attribute DOMString? iconPath; attribute DOMString? subIconPath; attribute long? number; attribute NotificationDetailInfo[]? detailInfo; attribute DOMString? ledColor; attribute unsigned long ledOnPeriod; attribute unsigned long ledOffPeriod; attribute DOMString? backgroundImagePath; attribute DOMString[]? thumbnails; attribute DOMString? soundPath; attribute boolean vibration; attribute ApplicationControl? appControl; attribute ApplicationId? appId; attribute NotificationProgressType progressType; attribute unsigned long? progressValue; }; [Constructor(DOMString mainText, optional DOMString? subText)] interface NotificationDetailInfo { attribute DOMString mainText; attribute DOMString? subText; }; };