Class

# NotificationContent

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used when creating notifications to send.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                               | Type                                                   | Read-Only | Shared |
|----------------------------------------------------|--------------------------------------------------------|-----------|--------|
| `Badge<notificationcontent.badge>`                 | `Integer</api/data_types/integer>`                     |           |        |
| `Body<notificationcontent.body>`                   | `String</api/data_types/string>`                       |           |        |
| `FocusPriority<notificationcontent.focuspriority>` | `FocusPriorities<notificationcontent.focuspriorities>` |           |        |
| `Handle<notificationcontent.handle>`               | `Ptr</api/data_types/additional_types/ptr>`            |           |        |
| `Relevance<notificationcontent.relevance>`         | `Integer</api/data_types/integer>`                     |           |        |
| `Subtitle<notificationcontent.subtitle>`           | `String</api/data_types/string>`                       |           |        |
| `Thread<notificationcontent.thread>`               | `String</api/data_types/string>`                       |           |        |
| `Title<notificationcontent.title>`                 | `String</api/data_types/string>`                       |           |        |
| `UserData<notificationcontent.userdata>`           | `Dictionary</api/language/dictionary>`                 |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                            | Parameters                                                                                                                                                                                                                                                                                                                                                                  | Returns | Shared |
|-------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
| `Constructor<notificationcontent.constructor0>` | title As `String</api/data_types/string>`, subtitle As `String</api/data_types/string>` = "", body As `String</api/data_types/string>` = "", badge As `Integer</api/data_types/integer>` = 0, data As `Dictionary</api/language/dictionary>` = `Nil</api/language/nil>`, thread As `String</api/data_types/string>` = "", category As `String</api/data_types/string>` = "" |         |        |

## Enumerations

<div id="notificationcontent.focuspriorities">

<div class="rst-class">

forsearch

</div>

</div>

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

<div id="notificationcontent.badge">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.Badge

**Badge** As `Integer</api/data_types/integer>`

> The number that should appear on the app icon when the notification is presented.

<div id="notificationcontent.body">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.Body

**Body** As `String</api/data_types/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.

<div id="notificationcontent.focuspriority">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.FocusPriority

**FocusPriority** As `FocusPriorities<notificationcontent.focuspriorities>`

> Dictates how the content should be handled should the user have a focus enabled.
>
> See the `FocusPriorities<notificationcontent.focuspriorities>` enumeration for details on the various priorities available.

<div id="notificationcontent.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> A pointer to the notification for use with declares.

<div id="notificationcontent.relevance">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.Relevance

**Relevance** As `Integer</api/data_types/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.

<div id="notificationcontent.subtitle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.Subtitle

**Subtitle** As `String</api/data_types/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.

<div id="notificationcontent.thread">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.Thread

**Thread** As `String</api/data_types/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.

<div id="notificationcontent.title">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.Title

**Title** As `String</api/data_types/string>`

> The title of the notification message.

<div id="notificationcontent.userdata">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.UserData

**UserData** As `Dictionary</api/language/dictionary>`

> Information sent along with the notification.
>
> The underlying data structure is `JSON</api/text/json/jsonitem>` format.
>
> Subsequent changes to DictionaryValue will not update the contents of UserData.

## Method descriptions

<div id="notificationcontent.constructor0">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

NotificationContent.Constructor

**Constructor**(title As `String</api/data_types/string>`, subtitle As `String</api/data_types/string>` = "", body As `String</api/data_types/string>` = "", badge As `Integer</api/data_types/integer>` = 0, data As `Dictionary</api/language/dictionary>` = `Nil</api/language/nil>`, thread As `String</api/data_types/string>` = "", category As `String</api/data_types/string>` = "")

> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> `Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.
>
> </div>
>
> Creates a <span class="title-ref">NotificationContent</span> object from the values passed.
>
> ``` xojo
> NotificationCenter.Send(New NotificationContent("Sale Starts Now!"))
> ```

## Notes

This class is to simplify creating notifications, specifically with its constructor:

``` xojo
NotificationCenter.Send(New NotificationContent("Sale Starts Now!"))
```

## Compatibility

|                       |        |
|-----------------------|--------|
| **Project Types**     | Mobile |
| **Operating Systems** | iOS    |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `CalendarNotification</api/user_interface/notifications/calendarnotification>`, `LocationNotification</api/user_interface/notifications/locationnotification>`, `TimeIntervalNotification</api/user_interface/notifications/timeintervalnotification>`, and `RemoteNotification</api/user_interface/notifications/remotenotification>` classes.

</div>
