docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Class NotificationCenter

    Send, receive and manage notifications. Must be initialized before use. See Initialize(NotificationCenterArgs).

    Inheritance
    object
    NotificationCenter
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Notifications
    Assembly: solution.dll
    Syntax
    public static class NotificationCenter

    Properties

    Name Description
    LastRespondedNotification

    Returns last notification tapped by user, or null.

    Methods

    Name Description
    CancelAllDeliveredNotifications()

    Remove all already delivered notifications.

    CancelAllScheduledNotifications()

    Cancel all future notifications.

    CancelDeliveredNotification(int)

    Cancel delivered notification. Removes notification from the tray.

    CancelScheduledNotification(int)

    Cancel a scheduled notification.

    ClearBadge()

    Clear Application badge. iOS only. iOS applications can set numeric badge on app icon. Calling this method removes that badge. On Android badge is removed automatically when notifications are removed.

    Initialize(NotificationCenterArgs)

    Initializes notification center with given arguments. On Android it will also create notification channel if arguments are set accordingly.

    OpenNotificationSettings(NotificationSettingsSection)

    Opens settings for the application. If possible, will try to navigate as close to requested section as it can. On iOS and Android prior to 8.0 will open settings for the application. Since Android 8.0 will open notification settings for either application or the default channel.

    RequestPermission()

    Request for users permission to post notifications. Requests users permission to send notifications. Unless already allowed or permanently denied, shows UI to the user. Users can revoke permission in Settings while app is not running.

    ScheduleNotification<T>(Notification, string, T)

    Schedule notification to be shown in the future. Allows to explicitly specify the category to send notification to. On Android it is notification channel. Channel or category has to be created manually using AndroidNotificationCenter and iOSNotificationCenter respectively.

    ScheduleNotification<T>(Notification, T)

    Schedule notification to be shown in the future.

    Events

    Name Description
    OnNotificationReceived

    An event that fires when notification is received. Application must be running for this event to work. On Android this even fires if application is in foreground or when it's brought back from background. On iOS this even only fires when notification is received while app is in foreground.

    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