Class ISN_UNUserNotificationCenter
The central object for managing notification-related activities for your app or app extension.
Inheritance
Inherited Members
Namespace: SA.iOS.UserNotifications
Assembly: cs.temp.dll.dll
Syntax
public static class ISN_UNUserNotificationCenter
Methods
AddNotificationRequest(ISN_UNNotificationRequest, Action<SA_Result>)
Schedules a local notification for delivery.
This method schedules local notifications only; You cannot use it to schedule the delivery of push notifications. The notification is delivered when the trigger condition in the request parameter is met. If the request does not contain a ISN_UNNotificationTrigger object, the notification is delivered right away.
You may call this method from any thread of your app.
Declaration
public static void AddNotificationRequest(ISN_UNNotificationRequest request, Action<SA_Result> callback)
Parameters
Type | Name | Description |
---|---|---|
ISN_UNNotificationRequest | request | The notification request to schedule.This parameter must not be |
Action<SA_Result> | callback | The block to execute with the results. |
GetDeliveredNotifications(Action<List<ISN_UNNotification>>)
Provides you with a list of the app’s notifications that are still displayed in Notification Center.
This method executes asynchronously, returning immediately and executing the provided block on a background thread when the results become available.
Declaration
public static void GetDeliveredNotifications(Action<List<ISN_UNNotification>> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<List<ISN_UNNotification>> | callback | The block to execute with the results. |
GetNotificationSettings(Action<ISN_UNNotificationSettings>)
Requests the notification settings for this app.
Use this method to determine the specific notification-related features that your app is allowed to use. When the user authorizes your app to post notifications, the system authorizes your app with a set of default notification-related settings. The user may further customize those settings to enable or disable specific capabilities. For example, the user might disable the playing of sounds in conjunction with your notifications. You can use the settings in the provided object to adjust the content of any scheduled notifications.
Declaration
public static void GetNotificationSettings(Action<ISN_UNNotificationSettings> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<ISN_UNNotificationSettings> | callback | The block to execute asynchronously with the results. |
GetPendingNotificationRequests(Action<List<ISN_UNNotificationRequest>>)
Returns a list of all notification requests that are scheduled and waiting to be delivered.
This method executes asynchronously, returning immediately and executing the provided block on a secondary thread when the results are available.
Declaration
public static void GetPendingNotificationRequests(Action<List<ISN_UNNotificationRequest>> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<List<ISN_UNNotificationRequest>> | callback | A block for processing notification requests. |
RemoveAllDeliveredNotifications()
Removes all of the app’s notifications from Notification Center.
Use this method to remove all of your app’s notifications from Notification Center. The method executes asynchronously, returning immediately and removing the identifiers on a background thread.
Declaration
public static void RemoveAllDeliveredNotifications()
RemoveAllPendingNotificationRequests()
Unschedule all pending notification requests. This method executes asynchronously, removing all pending notification requests on a secondary thread.
Declaration
public static void RemoveAllPendingNotificationRequests()
RemoveDeliveredNotifications(String[])
Removes the specified notifications from Notification Center.
Use this method to selectively remove notifications that you no longer want displayed in Notification Center. The method executes asynchronously, returning immediately and removing the identifiers on a background thread.
Declaration
public static void RemoveDeliveredNotifications(params string[] identifiers)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | identifiers | An array of System.String objects, each of which corresponds to the identifier
associated with a notification request object.
This method ignores the |
RemovePendingNotificationRequests(ISN_UNNotificationRequest[])
Unschedule the specified notification requests. This method executes asynchronously, removing the pending notification requests on a secondary thread.
Declaration
public static void RemovePendingNotificationRequests(params ISN_UNNotificationRequest[] requests)
Parameters
Type | Name | Description |
---|---|---|
ISN_UNNotificationRequest[] | requests | An array of ISN_UNNotificationRequest objects, each of which contains the identifier of an active notification request object. If the identifier belongs to a non repeating request whose notification has already been delivered, this method ignores the identifier. |
RemovePendingNotificationRequests(String[])
Unschedules the specified notification requests. This method executes asynchronously, removing the pending notification requests on a secondary thread.
Declaration
public static void RemovePendingNotificationRequests(params string[] identifiers)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | identifiers | An array of System.String objects, each of which contains the identifier of an active notification request object. If the identifier belongs to a non repeating request whose notification has already been delivered, this method ignores the identifier. |
RequestAuthorization(Int32, Action<SA_Result>)
Requests authorization to interact with the user when local and remote notifications arrive.
If the local or remote notifications of your app or app extension interact with the user in any way, you must call this method to request authorization for those interactions. The first time your app ever calls the method, the system prompts the user to authorize the requested options. The user may respond by granting or denying authorization, and the system stores the user’s response so that subsequent calls to this method do not prompt the user again. The user may change the allowed interactions at any time. Use the GetNotificationSettings(Action<ISN_UNNotificationSettings>) method to determine what your app is allowed to do.
After determining the authorization status, the user notification center object executes the block you provide in the
Always call this method before scheduling any local notifications and before registering with the Apple Push Notification Service. Typically, you call this method at launch time when configuring your app's notification support. However, you may call it at another time in your app's life cycle, providing that you call it before performing any other notification-related tasks.
Declaration
public static void RequestAuthorization(int options, Action<SA_Result> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | options | The authorization options your app is requesting. You may combine the available constants to request authorization for multiple items. Request only the authorization options that you plan to use. For a list of possible values, see ISN_UNAuthorizationOptions |
Action<SA_Result> | callback | The block to execute asynchronously with the results. |