Class NotificationManager
Definition
- Namespace:
- Tizen.Applications.Notifications
- Assembly:
- Tizen.Applications.Notification.dll
- API Level:
- 3
NotificationManager class to post, update, delete, and get notification.
C#Copypublic static class NotificationManager
- Inheritance
-
System.ObjectNotificationManager
Methods
Declaration
C#Copypublic static void Delete(Notification notification)
Parameters
Type | Name | Description |
---|---|---|
Notification | notification | Notification to remove. |
Examples
CopyNotification notification = new Notification { Title = "title", Content = "content", Icon = "absolute icon path", Tag = "first notification" }; NotificationManager.Post(notification); // do something NotificationManager.Delete(notification);
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when an argument is invalid. |
UnauthorizedAccessException | Thrown in case of a permission is denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/notification
Precondition: Post method should be called on the notification object.
Declaration
C#Copypublic static void DeleteAll()
Examples
CopyNotification firstNotification = new Notification { Title = "title", Content = "content", Icon = "absolute icon path", Tag = "first notification" }; NotificationManager.Post(firstNotification); Notification secondNotification = new Notification { Title = "title", Content = "content", Icon = "absolute icon path", Tag = "second notification" }; NotificationManager.Post(secondNotification); NotificationManager.DeleteAll();
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Thrown in case of a permission is denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/notification
Declaration
C#Copypublic static NotificationBlockState GetBlockState()
Returns
Type | Description |
---|---|
NotificationBlockState | NotificationBlockState is a state if notification is posted. |
Remarks
The user can set the notification block state in settings. The block state indicates whether or not notifications can be posted. Additionally, only notifications to the notification panel are allowed in "Do not disturb mode". Sound, vibrate, and active notifications are blocked.
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Thrown in case of a permission is denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/notification
Load(String)
Searches for a posted notification which has the specified tag and has not been deleted yet.
Declaration
C#Copypublic static Notification Load(string tag)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | Tag used to query. |
Returns
Type | Description |
---|---|
Notification | Notification Object with specified tag. |
Remarks
Load method should be called only for notifications, which have been posted using the NotificationManager.Post method. If two or more notifications share the same tag, the notification posted most recently is returned.
Examples
CopyNotification notification = new Notification { Title = "title", Content = "content", Icon = "absolute icon path", Tag = "first notification" }; NotificationManager.Post(notification); // do someting Notification loadNotification = NotificationManager.Load("first notification");
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Throwing the same exception when argument is invalid and when the tag does not exist is misleading. |
UnauthorizedAccessException | Thrown in case of permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/notification
Declaration
C#Copypublic static Notification LoadTemplate(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Template name. |
Returns
Type | Description |
---|---|
Notification | Notification Object with inputted template name. |
Examples
CopyNotification notification = new Notification { Title = "title", Content = "content", Icon = "absolute icon path", Tag = "first notification" }; Notification.Accessory accessory = new Notification.Accessory { LedOption = AccessoryOption.On, VibrationOption = AccessoryOption.Custom, VibrationPath = "vibration absolute path" } notification.setAccessory(accessory); // do something NotificationManager.Post(notification); Notification.LockStyle style = new Notification.LockStyle { IconPath = "icon path", ThumbnailPath = "Thumbnail path" } notification.AddStyle(style); NotificationManager.SaveTemplate(notification, "firstTemplate"); Notification notificationTemplate = NotificationManager.LoadTemplate("firstTemplate");
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Throwing the same exception when argument is invalid and when the template does not exist is misleading. |
UnauthorizedAccessException | Thrown in case of permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/notification
Declaration
C#Copypublic static void Post(Notification notification)
Parameters
Type | Name | Description |
---|---|---|
Notification | notification | Notification to post. |
Examples
CopyNotification notification = new Notification { Title = "title", Content = "content", Icon = "absolute icon path", Tag = "first notification" }; Notification.AccessorySet accessory = new Notification.AccessorySet { SoundOption = AccessoryOption.On, CanVibrate = true }; notification.Accessory = accessory; // do something NotificationManager.Post(notification);
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when an argument is invalid. |
UnauthorizedAccessException | Thrown in case of a permission is denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/notification
SaveTemplate(Notification, String)
Saves a notification template to the notification database.
Declaration
C#Copypublic static void SaveTemplate(Notification notification, string name)
Parameters
Type | Name | Description |
---|---|---|
Notification | notification | Notification to save as template. |
System.String | name | Template name. |
Examples
CopyNotification notification = new Notification { Title = "title", Content = "content", Icon = "absolute icon path", Tag = "first notification" }; Notification.Accessory accessory = new Notification.Accessory { LedOption = AccessoryOption.On, VibrationOption = AccessoryOption.Custom, VibrationPath = "vibration absolute path" } notification.setAccessory(accessory); // do something NotificationManager.Post(notification); Notification.LockStyle style = new Notification.LockStyle { IconPath = "icon path", ThumbnailPath = "Thumbnail path" } notification.AddStyle(style); NotificationManager.SaveTemplate(notification, "firstTemplate");
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when an argument is invalid. |
UnauthorizedAccessException | Thrown in case of a permission is denied. |
InvalidOperationException | Thrown when it can't be saved as a template. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/notification
Declaration
C#Copypublic static void Update(Notification notification)
Parameters
Type | Name | Description |
---|---|---|
Notification | notification | Notification to update. |
Examples
Copystring tag = "first tag"; Notification notification = new Notification { Title = "title", Content = "content", Icon = "absolute icon path", Tag = tag }; Notification.AccessorySet accessory = new Notification.AccessorySet { LedOption = AccessoryOption.On, VibrationOption = AccessoryOption.Custom, VibrationPath = "vibration absolute path" } notification.Accessory = accessory; NotificationManager.Post(notification); // do something Notification loadNotification = NotificationManager.Load(tag); loadNotification.Progress = new ProgressType(ProgressCategory.Percent, 0.0. 100.0); Thread thread = new Thread(new ParameterizedThreadStart(UpdateProgress)); thread.IsBackground = true; thread.Start(notification); ... static void UpdateProgress(Object obj) { Notification notification = (Notification)obj; for (double current = 1.0; current <= 100.0; current = current + 1.0) { notification.Progress.ProgressCurrent = current; NotificationManager.Update(notification); Thread.Sleep(300); } }
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when an argument is invalid. |
UnauthorizedAccessException | Thrown in case of a permission is denied. |
InvalidOperationException | Thrown in case of any internal error. |