Class Notification

Definition

Namespace:
Tizen.Applications.Notifications
Assembly:
Tizen.Applications.Notification.dll
API Level:
3

This class contains common properties and methods of notifications.

C#
Copy
public sealed class Notification : IDisposable
Inheritance
Notification
Implements
System.IDisposable
Remarks

A notification is a message that is displayed on the notification area. It is created to notify information to the user through the application. This class helps you to provide method and property for creating notification object.

Constructors

View Source

Notification()

Initializes a new instance of the Notification class.

Declaration
C#
Copy
public Notification()
API Level: 3

Properties

View Source

Accessory

Gets or sets Notification.AccessorySet which is included vibration, LED and sound option to be applied at notification.

Declaration
C#
Copy
public Notification.AccessorySet Accessory { get; set; }
Property Value
Type Description
Notification.AccessorySet
Remarks

If you set it to null, the already set AccessorySet will be initialized.

Examples
Copy
Notification notification = new Notification { Title = "Notification", Content = "Hello Tizen", Icon = "Icon path", Count = 3 }; Notification.AccessorySet accessory = new Notification.AccessorySet { SoundOption = AccessoryOption.Custom, SoundPath = "Sound File Path", IsVibration = true, LedOption = AccessoryOption.Custom, LedOnMs = 100; LedOffMs = 50; LedColor = Color.Lime }; notification.Accessory = accessory; NotificationManager.Post(notification);
API Level: 3
View Source

Action

Gets or sets action, which is invoked when the notification is clicked.

Declaration
C#
Copy
public AppControl Action { get; set; }
Property Value
Type Description
AppControl
Remarks

If you set it to null, the already set AppControl will be removed and nothing will happen when you click on notification.

See Also
API Level: 3
View Source

Content

Gets or sets the content of notification.

Declaration
C#
Copy
public string Content { get; set; }
Property Value
Type Description
System.String
API Level: 3
View Source

Count

Gets or sets count, which is displayed at the right side of the notification.

Declaration
C#
Copy
public int Count { get; set; }
Property Value
Type Description
System.Int32
Remarks

You must set only positive number. If you set count to negative number, this property throws exception.

Exceptions
Type Condition
System.ArgumentException

Thrown when argument is invalid.

API Level: 3
View Source

Icon

Gets or sets the icon of notification. You should set an absolute path for an image file.

Declaration
C#
Copy
public string Icon { get; set; }
Property Value
Type Description
System.String
API Level: 3
View Source

IsTimeStampVisible

Gets or sets a value indicating whether TimeStamp of the notification is Visible or not. Default to true.

Declaration
C#
Copy
public bool IsTimeStampVisible { get; set; }
Property Value
Type Description
System.Boolean
API Level: 3
View Source

IsVisible

Gets or sets a value indicating whether notification is displayed on the default viewer. If you set false and add style, you can see only style notification.

Declaration
C#
Copy
public bool IsVisible { get; set; }
Property Value
Type Description
System.Boolean
API Level: 4
View Source

Progress

Gets or sets Notification.ProgressType object for display at notification.

Declaration
C#
Copy
public Notification.ProgressType Progress { get; set; }
Property Value
Type Description
Notification.ProgressType
API Level: 3
View Source

Property

Gets or sets property.

Declaration
C#
Copy
public NotificationProperty Property { get; set; }
Property Value
Type Description
NotificationProperty
API Level: 3
View Source

SubIcon

Gets or sets the sub icon of notification. This SubIcon is displayed in Icon you set. You should set an absolute path for an image file.

Declaration
C#
Copy
public string SubIcon { get; set; }
Property Value
Type Description
System.String
API Level: 3
View Source

Tag

Gets or sets the tag of notification.

Declaration
C#
Copy
public string Tag { get; set; }
Property Value
Type Description
System.String
API Level: 3
View Source

TimeStamp

Gets or sets the TimeStamp of notification.

Declaration
C#
Copy
public DateTime TimeStamp { get; set; }
Property Value
Type Description
System.DateTime
Remarks

If you don't set TimeStamp, it will set the value when the notification is posted. TimeStamp requires NotificationManager.Post() to be called. If you set IsVisibleTimeStamp property to false, TimeStamp is not visible in notification.

API Level: 3
View Source

Title

Gets or sets the title of notification.

Declaration
C#
Copy
public string Title { get; set; }
Property Value
Type Description
System.String
API Level: 3

Methods

View Source

AddStyle(Notification.StyleBase)

Method for adding various styles to be applied to notification.

Declaration
C#
Copy
public void AddStyle(Notification.StyleBase style)
Parameters
Type Name Description
Notification.StyleBase style

The style to be applied to notification.

Remarks

The user always see about valid notification style. If you add a style which is not supported in platform, this method has no effect.

Examples
Copy
Notification notification = new Notification { Title = "Notification", Content = "Hello Tizen", Icon = "Icon path", Count = 3 }; Notification.LockStyle lockStyle = new Notification.LockStyle { IconPath = "Icon path", ThumbnailPath = "Thumbnail Path" }; notification.AddStyle(lockStyle); NotificationManager.Post(notification);
Exceptions
Type Condition
System.ArgumentException

Thrown when argument is invalid.

API Level: 3
View Source

Dispose()

Releases any unmanaged resources used by this object.

Declaration
C#
Copy
public void Dispose()
API Level: 3
View Source

GetExtraData(String)

Method to get extra data you already set.

Declaration
C#
Copy
public Bundle GetExtraData(string key)
Parameters
Type Name Description
System.String key

The key of the extra data to get.

Returns
Type Description
Bundle

Bundle Object that include extra data

Exceptions
Type Condition
System.ArgumentException

Thrown when argument is invalid.

API Level: 4
View Source

GetStyle<T>()

Method to get style you already added.

Declaration
C#
Copy
public T GetStyle<T>() where T : Notification.StyleBase, new()
Returns
Type Description
T

The Notification.Style object associated with the given style.

Type Parameters
Name Description
T

Type of notification style to be queried.

Exceptions
Type Condition
System.ArgumentException

Thrown when argument is invalid.

API Level: 3
View Source

RemoveExtraData(String)

Method to remove extra you already added.

Declaration
C#
Copy
public void RemoveExtraData(string key)
Parameters
Type Name Description
System.String key

The key of the extra data to add.

Remarks

The type of extra data is bundle.

Exceptions
Type Condition
System.ArgumentException

Thrown when argument is invalid.

API Level: 4
View Source

RemoveStyle<T>()

Method to remove style you already added.

Declaration
C#
Copy
public void RemoveStyle<T>() where T : Notification.StyleBase, new()
Type Parameters
Name Description
T

Type of notification style to be queried.

Exceptions
Type Condition
System.ArgumentException

Thrown when argument is invalid.

API Level: 3
View Source

SetExtraData(String, Bundle)

Method to set extra data to add extra data.

Declaration
C#
Copy
public void SetExtraData(string key, Bundle value)
Parameters
Type Name Description
System.String key

The key of the extra data you want to add.

Bundle value

The value you want to add.

Remarks

The type of extra data is bundle.

Examples
Copy
Notification notification = new Notification { Title = "Notification", Content = "Hello Tizen", Icon = "Icon path", }; Bundle bundle = new Bundle(); bundle.AddItem("key", "value"); notification.SetExtraData("firstKey", bundle);
Exceptions
Type Condition
System.ArgumentException

Thrown when argument is invalid.

API Level: 4

Implements

System.IDisposable