Class iOSNotificationCenter
Use the iOSNotificationCenter to register notification channels and schedule local notifications.
Namespace: Unity.Notifications.iOS
Syntax
public class iOSNotificationCenter
Properties
ApplicationBadge
The number currently set as the badge of the app icon.
Declaration
public static int ApplicationBadge { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
GetDeliveredNotifications()
Returns all of the app's delivered notifications that are currently shown in the Notification Center.
Declaration
public static iOSNotification[] GetDeliveredNotifications()
Returns
Type | Description |
---|---|
iOSNotification[] | Array of delivered notifications |
GetLastRespondedNotification()
Use this to retrieve the last local or remote notification received by the app.
Declaration
public static iOSNotification GetLastRespondedNotification()
Returns
Type | Description |
---|---|
iOSNotification | Returns the last local or remote notification used to open the app or clicked on by the user. If no notification is available it returns null. |
GetNotificationSettings()
Get the notification settings for this app.
Declaration
public static iOSNotificationSettings GetNotificationSettings()
Returns
Type | Description |
---|---|
iOSNotificationSettings | Notification settings |
GetScheduledNotifications()
Returns all notifications that are currently scheduled.
Declaration
public static iOSNotification[] GetScheduledNotifications()
Returns
Type | Description |
---|---|
iOSNotification[] | Array of scheduled notifications |
RemoveAllDeliveredNotifications()
Removes all of the app's delivered notifications from the Notification Center.
Declaration
public static void RemoveAllDeliveredNotifications()
RemoveAllScheduledNotifications()
Unschedules all pending notification.
Declaration
public static void RemoveAllScheduledNotifications()
RemoveDeliveredNotification(String)
Removes the specified notification from Notification Center.
Declaration
public static void RemoveDeliveredNotification(string identifier)
Parameters
Type | Name | Description |
---|---|---|
String | identifier | Identifier for the notification to be removed |
RemoveScheduledNotification(String)
Unschedules the specified notification.
Declaration
public static void RemoveScheduledNotification(string identifier)
Parameters
Type | Name | Description |
---|---|---|
String | identifier | Identifier for the notification to be removed |
ScheduleNotification(iOSNotification)
Schedules a local notification for delivery.
Declaration
public static void ScheduleNotification(iOSNotification notification)
Parameters
Type | Name | Description |
---|---|---|
iOSNotification | notification | Notification to schedule |
Events
OnNotificationReceived
Subscribe to this event to receive a callback whenever a local notification or a remote is shown to the user.
Declaration
public static event iOSNotificationCenter.NotificationReceivedCallback OnNotificationReceived
Event Type
Type | Description |
---|---|
iOSNotificationCenter.NotificationReceivedCallback |
OnRemoteNotificationReceived
Subscribe to this event to receive a callback whenever a remote notification is received while the app is in foreground, if you subscribe to this event remote notification will not be shown while the app is in foreground and if you still want to show it to the user you will have to schedule a local notification with the data received from this callback. If you want remote notifications to be shown automatically subscribe to the [[OnNotificationReceived]] even instead and check the [[Notification.Trigger]] class type to determine whether the received notification is a remote notification.
Declaration
public static event iOSNotificationCenter.NotificationReceivedCallback OnRemoteNotificationReceived
Event Type
Type | Description |
---|---|
iOSNotificationCenter.NotificationReceivedCallback |