docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class iOSNotificationCenter

    Use the iOSNotificationCenter to register notification channels and schedule local notifications.

    Inheritance
    object
    iOSNotificationCenter
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Notifications.iOS
    Assembly: solution.dll
    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
    int

    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. Do not call this in Awake or Start of the first scene, wait for at least a frame. On cold app start iOS reports this with small delay.

    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.

    See Also
    SetNotificationCategories(IEnumerable<iOSNotificationCategory>)

    GetLastRespondedNotificationAction()

    Get users chosen action for the last actionable notification, null if no action was chosen.

    Declaration
    public static string GetLastRespondedNotificationAction()
    Returns
    Type Description
    string

    Action identifier

    See Also
    SetNotificationCategories(IEnumerable<iOSNotificationCategory>)

    GetLastRespondedNotificationUserText()

    Get users text input for the last actionable notification with input support, null if no input.

    Declaration
    public static string GetLastRespondedNotificationUserText()
    Returns
    Type Description
    string

    Text user extered in the input field from notification

    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

    OpenNotificationSettings()

    Opens Settings. On iOS there is no way to open notification settings specifically, but you can open settings app with current application settings. Note, that application will be suspended, since opening settings is switching to different application.

    Declaration
    public static void OpenNotificationSettings()

    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

    SetNotificationCategories(IEnumerable<iOSNotificationCategory>)

    Set (replace if already set) notification categories. Use this to setup actionable notifications. You can specify actions for each category, which then will be available for each notification with the same category identifier. Categories must be registered before sending notifications.

    Declaration
    public static void SetNotificationCategories(IEnumerable<iOSNotificationCategory> categories)
    Parameters
    Type Name Description
    IEnumerable<iOSNotificationCategory> categories

    All notification categories for your application

    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
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)