Class NotificationManager

    Definition

    Namespace:
    Tizen.Applications.Notifications
    Assembly:
    Tizen.Applications.Notification.dll

    NotificationManager class to post, update, delete, and get notification.

    public static class NotificationManager
    Inheritance
    object
    NotificationManager

    Methods

    View Source

    Delete(Notification)

    Deletes a posted notification.

    Declaration
    public static void Delete(Notification notification)
    Parameters
    Type Name Description
    Notification notification

    Notification to remove.

    Examples
    Notification notification = new Notification
    {
        Title = "title",
        Content = "content",
        Icon = "absolute icon path",
        Tag = "first notification"
    };
    NotificationManager.Post(notification);
    
        // do something
    
    NotificationManager.Delete(notification);
    View Source

    DeleteAll()

    Removes all posted notifications of calling application.

    Declaration
    public static void DeleteAll()
    Examples
    Notification 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();
    View Source

    GetBlockState()

    Gets notification block state.

    Declaration
    public 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.

    View Source

    Load(string)

    Searches for a posted notification which has the specified tag and has not been deleted yet.

    Declaration
    public static Notification Load(string tag)
    Parameters
    Type Name Description
    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
    Notification 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");
    View Source

    LoadTemplate(string)

    Loads a notification template from the notification database.

    Declaration
    public static Notification LoadTemplate(string name)
    Parameters
    Type Name Description
    string name

    Template name.

    Returns
    Type Description
    Notification

    Notification Object with inputted template name.

    Examples
    Notification 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");
    View Source

    MakeNotification(NotificationSafeHandle)

    Make a Notification from NotificationSafeHandle.

    Declaration
    public static Notification MakeNotification(NotificationSafeHandle handle)
    Parameters
    Type Name Description
    NotificationSafeHandle handle

    The NotificationSafeHandle class.

    Returns
    Type Description
    Notification

    The Notification class.

    View Source

    MakeNotificationSafeHandle(Notification)

    Make a NotificationSafeHandle from Notification.

    Declaration
    public static NotificationSafeHandle MakeNotificationSafeHandle(Notification notification)
    Parameters
    Type Name Description
    Notification notification

    The Notification class.

    Returns
    Type Description
    NotificationSafeHandle

    The NotificationSafeHandle class.

    View Source

    Post(Notification)

    Posts a new notification.

    Declaration
    public static void Post(Notification notification)
    Parameters
    Type Name Description
    Notification notification

    Notification to post.

    Examples
    Notification 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);
    View Source

    RegisterDoNotDisturbApp()

    Register do not disturb app

    Declaration
    public static void RegisterDoNotDisturbApp()
    View Source

    SaveTemplate(Notification, string)

    Saves a notification template to the notification database.

    Declaration
    public static void SaveTemplate(Notification notification, string name)
    Parameters
    Type Name Description
    Notification notification

    Notification to save as template.

    string name

    Template name.

    Examples
    Notification 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");
    View Source

    Update(Notification)

    Updates a posted notification.

    Declaration
    public static void Update(Notification notification)
    Parameters
    Type Name Description
    Notification notification

    Notification to update.

    Examples
    string 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);
        }
    }

    Events

    View Source

    DisturbReceived

    The event handler to get

    Declaration
    public static event EventHandler DisturbReceived
    Event Type
    Type Description
    EventHandler
    View Source

    ResponseReceived

    The event handler for receiving a response event from the notification viewers

    Declaration
    public static event EventHandler<NotificationResponseEventArgs> ResponseReceived
    Event Type
    Type Description
    EventHandler<><NotificationResponseEventArgs>
    • View Source
    Back to top Copyright © 2016-2025 Samsung
    Generated by DocFX