docs.unity3d.com

Mobile Notifications 2.3.2

Search Results for

    Show / Hide Table of Contents

    Class iOSNotification

    The iOSNotification class is used schedule local notifications. It includes the content of the notification and the trigger conditions for delivery. An instance of this class is also returned when receiving remote notifications..

    Inheritance
    object
    iOSNotification
    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 iOSNotification
    Remarks

    Create an instance of this class when you want to schedule the delivery of a local notification. It contains the entire notification payload to be delivered (which corresponds to UNNotificationContent) and also the NotificationTrigger object with the conditions that trigger the delivery of the notification. To schedule the delivery of your notification, pass an instance of this class to the ScheduleNotification(iOSNotification) method.

    Constructors

    iOSNotification()

    Create a new instance of iOSNotification and automatically generate an unique string for Identifier with all optional fields set to default values.

    Declaration
    public iOSNotification()

    iOSNotification(string)

    Specify a Identifier and create a notification object with all optional fields set to default values.

    Declaration
    public iOSNotification(string identifier)
    Parameters
    Type Name Description
    string identifier

    Unique identifier for the local notification tha can later be used to track or change it's status.

    Properties

    Attachments

    A list of notification attachments. Notification attachments can be images, audio or video files. Refer to Apple documentation on supported formats. https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent/1649857-attachments?language=objc

    Declaration
    public List<iOSNotificationAttachment> Attachments { get; set; }
    Property Value
    Type Description
    List<iOSNotificationAttachment>

    Badge

    The number to display as a badge on the app’s icon.

    Declaration
    public int Badge { get; set; }
    Property Value
    Type Description
    int

    Body

    The message displayed in the notification alert. See Apple's documentation for details. https://developer.apple.com/documentation/usernotifications/unnotificationcontent/1649863-body

    Declaration
    public string Body { get; set; }
    Property Value
    Type Description
    string

    CategoryIdentifier

    The identifier of the app-defined category object.

    Declaration
    public string CategoryIdentifier { get; set; }
    Property Value
    Type Description
    string

    Data

    Arbitrary string data which can be retrieved when the notification is used to open the app or is received while the app is running. Push notification is sent to the device as JSON. The value for data key is set to the Data property on notification.

    Declaration
    public string Data { get; set; }
    Property Value
    Type Description
    string

    ForegroundPresentationOption

    Presentation options for displaying the local of notification when the app is running. Only works if ShowInForeground is enabled and user has allowed enabled the requested options for your app.

    Declaration
    public PresentationOption ForegroundPresentationOption { get; set; }
    Property Value
    Type Description
    PresentationOption

    Identifier

    The unique identifier for this notification request.

    Declaration
    public string Identifier { get; set; }
    Property Value
    Type Description
    string
    Remarks

    If not explicitly specified the identifier will be automatically generated when creating the notification.

    InterruptionLevel

    The notification’s importance and required delivery timing.

    Declaration
    public NotificationInterruptionLevel InterruptionLevel { get; set; }
    Property Value
    Type Description
    NotificationInterruptionLevel

    RelevanceScore

    The score the system uses to determine if the notification is the summary’s featured notification. https://developer.apple.com/documentation/usernotifications/unnotificationcontent/3821031-relevancescore?language=objc

    Declaration
    public double RelevanceScore { get; set; }
    Property Value
    Type Description
    double

    ShowInForeground

    Indicates whether the notification alert should be shown when the app is open.

    Declaration
    public bool ShowInForeground { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    Subscribe to the OnNotificationReceived event to receive a callback when the notification is triggered.

    SoundName

    The name of the sound to be played. Use null for system default sound. See Apple documentation for named sounds and sound file placement.

    Declaration
    public string SoundName { get; set; }
    Property Value
    Type Description
    string

    SoundType

    The type of sound to be played.

    Declaration
    public NotificationSoundType SoundType { get; set; }
    Property Value
    Type Description
    NotificationSoundType

    SoundVolume

    The volume for the sound. Use null to use the default volume. See Apple documentation for supported values. https://developer.apple.com/documentation/usernotifications/unnotificationsound/2963118-defaultcriticalsoundwithaudiovol?language=objc

    Declaration
    public float? SoundVolume { get; set; }
    Property Value
    Type Description
    float?

    Subtitle

    A secondary description of the reason for the notification.

    Declaration
    public string Subtitle { get; set; }
    Property Value
    Type Description
    string

    ThreadIdentifier

    An identifier that used to group related notifications together.

    Declaration
    public string ThreadIdentifier { get; set; }
    Property Value
    Type Description
    string
    Remarks

    Automatic notification grouping according to the thread identifier is only supported on iOS 12 and above.

    Title

    A short description of the reason for the notification.

    Declaration
    public string Title { get; set; }
    Property Value
    Type Description
    string

    Trigger

    The conditions that trigger the delivery of the notification. For notification that were already delivered and whose instance was returned by OnRemoteNotificationReceived or OnRemoteNotificationReceived use this property to determine what caused the delivery to occur. You can do this by comparing Trigger to any of the notification trigger types that implement it, such as iOSNotificationLocationTrigger, iOSNotificationPushTrigger, iOSNotificationTimeIntervalTrigger, iOSNotificationCalendarTrigger.

    Declaration
    public iOSNotificationTrigger Trigger { get; set; }
    Property Value
    Type Description
    iOSNotificationTrigger
    Examples
    notification.Trigger is iOSNotificationPushTrigger

    UserInfo

    Key-value collection sent or received with the notification. Note, that some of the other notification properties are transfered using this collection, it is not recommended to modify existing items.

    Declaration
    public Dictionary<string, string> UserInfo { get; }
    Property Value
    Type Description
    Dictionary<string, string>
    In This Article
    • Constructors
      • iOSNotification()
      • iOSNotification(string)
    • Properties
      • Attachments
      • Badge
      • Body
      • CategoryIdentifier
      • Data
      • ForegroundPresentationOption
      • Identifier
      • InterruptionLevel
      • RelevanceScore
      • ShowInForeground
      • SoundName
      • SoundType
      • SoundVolume
      • Subtitle
      • ThreadIdentifier
      • Title
      • Trigger
      • UserInfo
    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)