UAPushNotificationDelegate

@protocol UAPushNotificationDelegate <NSObject>

Protocol to be implemented by push notification clients. All methods are optional.

  • Called when a notification is received in the foreground.

    Declaration

    Objective-C

    - (void)receivedForegroundNotification:
                (nonnull UANotificationContent *)notificationContent
                         completionHandler:(nonnull void (^)())completionHandler;

    Swift

    optional func receivedForegroundNotification(_ notificationContent: UANotificationContent, completionHandler: @escaping () -> Void)

    Parameters

    notificationContent

    UANotificationContent object representing the notification info.

    completionHandler

    the completion handler to execute when notification processing is complete.

  • Called when a notification is received in the background.

    Declaration

    Objective-C

    - (void)receivedBackgroundNotification:
                (nonnull UANotificationContent *)notificationContent
                         completionHandler:
                             (nonnull void (^)(UIBackgroundFetchResult))
                                 completionHandler;

    Swift

    optional func receivedBackgroundNotification(_ notificationContent: UANotificationContent, completionHandler: Any!)

    Parameters

    notificationContent

    UANotificationContent object representing the notification info.

    completionHandler

    the completion handler to execute when notification processing is complete.

  • Called when a notification is received in the background or foreground and results in a user interaction. User interactions can include launching the application from the push, or using an interactive control on the notification interface such as a button or text field.

    Declaration

    Objective-C

    - (void)receivedNotificationResponse:
                (nonnull UANotificationResponse *)notificationResponse
                       completionHandler:(nonnull void (^)())completionHandler;

    Swift

    optional func receivedNotificationResponse(_ notificationResponse: UANotificationResponse, completionHandler: @escaping () -> Void)

    Parameters

    notificationResponse

    UANotificationResponse object representing the user’s response to the notification and the associated notification contents.

    completionHandler

    the completion handler to execute when processing the user’s response has completed.

  • Called when a notification has arrived in the foreground and is available for display.

    Note: this method is relevant only for iOS 10 and above.

    Declaration

    Objective-C

    - (UNNotificationPresentationOptions)presentationOptionsForNotification:
        (nonnull UNNotification *)notification;

    Swift

    optional func presentationOptions(for notification: UNNotification) -> Any!

    Parameters

    notification

    The notification.

    Return Value

    a UNNotificationPresentationOptions enum value indicating the presentation options for the notification.