Class
NotificationContent
Description
Used when creating notifications to send.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
title As String, subtitle As String = "", body As String = "", badge As Integer = 0, data As Dictionary = Nil, thread As String = "", category As String = "" |
Enumerations
NotificationContent.FocusPriorities
FocusPriorities
The various priorities that dictate how the content should be handled should the user have a focus enabled.
Enum |
Description |
---|---|
Passive |
Does not show an alert, light up the screen or break through Focus settings. These notifications are delivered silently and are available the next time the notification list is viewed. Examples are Dining Recommendations and New Episode availability. |
Active |
This is the default and matches the behavior of iOS 14 and below. This priority can show up on screen, play sounds and will light up the screen. They will not break through Focus settings. Active should be used for notifications that do not warrant interrupting if the user does not want to be interrupted. |
TimeSensitive |
This priority is just like Active except that it can break through system controls such as notification summary and Focus if it has been allowed by the user. This priority should only be used when the notification requires immediate attention. For example, medication reminders, account security and package delivery alerts. |
Critical |
This priority is equivalent to the Critical notification support that exists is iOS 14. It can actively alert, break through system Focus settings and also bypass the ringer switch on the device. This priority requires a special entitlement from Apple. Examples would be weather alerts and local safety alerts. |
Property descriptions
NotificationContent.Badge
Badge As Integer
The number that should appear on the app icon when the notification is presented.
NotificationContent.Body
Body As String
The details of the notification message.
This information may not be shown if the device is locked and the user has hidden message details.
NotificationContent.FocusPriority
FocusPriority As FocusPriorities
Dictates how the content should be handled should the user have a focus enabled.
See the FocusPriorities enumeration for details on the various priorities available.
NotificationContent.Handle
Handle As Ptr
A pointer to the notification for use with declares.
NotificationContent.Relevance
Relevance As Integer
The level of relevance relative to other notifications created by the same app.
On iOS 15 and later, when the user opens the Notification Center, of the unread notifications from an app (if any), the one with the highest relevance will be included in the summary.
NotificationContent.Subtitle
Subtitle As String
A secondary line of text that appears below the title of the notification message.
This information may not be shown if the device is locked and the user has hidden message details.
NotificationContent.Thread
Thread As String
Identifies the thread to which the notification belongs.
Threads are a set of characters you create which allow notifications to be grouped together in the iOS notifications user interface.
NotificationContent.Title
Title As String
The title of the notification message.
NotificationContent.UserData
UserData As Dictionary
Information sent along with the notification.
The underlying data structure is JSON format.
Subsequent changes to DictionaryValue will not update the contents of UserData.
Method descriptions
NotificationContent.Constructor
Constructor(title As String, subtitle As String = "", body As String = "", badge As Integer = 0, data As Dictionary = Nil, thread As String = "", category As String = "")
Note
Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.
Creates a NotificationContent object from the values passed.
NotificationCenter.Send(New NotificationContent("Sale Starts Now!"))
Notes
This class is to simplify creating notifications, specifically with its constructor:
NotificationCenter.Send(New NotificationContent("Sale Starts Now!"))
Compatibility
iOS projects on the iOS operating system.
See also
Object parent class; CalendarNotification, LocationNotification, TimeIntervalNotification, and RemoteNotification classes.