docs.unity.cn
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

    Name Description
    ApplicationBadge

    The number currently set as the badge of the app icon.

    Methods

    Name Description
    GetDeliveredNotifications()

    Returns all of the app's delivered notifications that are currently shown in the Notification Center.

    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.

    GetLastRespondedNotificationAction()

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

    GetLastRespondedNotificationUserText()

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

    GetNotificationSettings()

    Get the notification settings for this app.

    GetScheduledNotifications()

    Returns all notifications that are currently scheduled.

    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.

    RemoveAllDeliveredNotifications()

    Removes all of the app's delivered notifications from the Notification Center.

    RemoveAllScheduledNotifications()

    Unschedules all pending notification.

    RemoveDeliveredNotification(string)

    Removes the specified notification from Notification Center.

    RemoveScheduledNotification(string)

    Unschedules the specified notification.

    ScheduleNotification(iOSNotification)

    Schedules a local notification for delivery.

    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.

    Events

    Name Description
    OnNotificationReceived

    Subscribe to this event to receive a callback whenever a local notification or a remote is shown to the user.

    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.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023