docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct AndroidNotification

    The AndroidNotification is used schedule a local notification, which includes the content of the notification.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.Notifications.Android
    Assembly: solution.dll
    Syntax
    public struct AndroidNotification

    Constructors

    AndroidNotification(string, string, DateTime)

    Create a notification struct with all optional fields set to default values.

    Declaration
    public AndroidNotification(string title, string text, DateTime fireTime)
    Parameters
    Type Name Description
    string title

    Notification title

    string text

    Text to show on notification

    DateTime fireTime

    Date and time when to show, can be DateTime.Now to show right away

    AndroidNotification(string, string, DateTime, TimeSpan)

    Create a repeatable notification struct with all optional fields set to default values.

    Declaration
    public AndroidNotification(string title, string text, DateTime fireTime, TimeSpan repeatInterval)
    Parameters
    Type Name Description
    string title

    Notification title

    string text

    Text to show on notification

    DateTime fireTime

    Date and time when to show, can be DateTime.Now to show right away

    TimeSpan repeatInterval

    Makes notification repeatable with this time interval

    Remarks

    There is a minimum period of 1 minute for repeating notifications.

    AndroidNotification(string, string, DateTime, TimeSpan, string)

    Create a notification struct with a custom small icon and all optional fields set to default values.

    Declaration
    public AndroidNotification(string title, string text, DateTime fireTime, TimeSpan repeatInterval, string smallIcon)
    Parameters
    Type Name Description
    string title

    Notification title

    string text

    Text to show on notification

    DateTime fireTime

    Date and time when to show, can be DateTime.Now to show right away

    TimeSpan repeatInterval

    Makes notification repeatable with this time interval

    string smallIcon

    Name of the small icon to be shown on notification

    Properties

    BigPicture

    The necessary properties for big picture style notification. For convenience, assigning this property will also set the Style property.

    Declaration
    public BigPictureStyle? BigPicture { get; set; }
    Property Value
    Type Description
    BigPictureStyle?

    Color

    Accent color to be applied by the standard style templates when presenting this notification. The template design constructs a colorful header image by overlaying the icon image (stenciled in white) atop a field of this color. Alpha components are ignored.

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

    CustomTimestamp

    Set this to show custom date instead of the notification's "FireTime" as the notification's timestamp'.

    Declaration
    public DateTime CustomTimestamp { get; set; }
    Property Value
    Type Description
    DateTime

    FireTime

    The date and time when the notification should be delivered.

    Declaration
    public DateTime FireTime { get; set; }
    Property Value
    Type Description
    DateTime

    Group

    Set this property for the notification to be made part of a group of notifications sharing the same key. Grouped notifications may display in a cluster or stack on devices which support such rendering. Only available on Android 7.0 (API level 24) and above.

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

    GroupAlertBehaviour

    Sets the group alert behavior for this notification. Set this property to mute this notification if alerts for this notification's group should be handled by a different notification. This is only applicable for notifications that belong to a group. This must be set on all notifications you want to mute. Only available on Android 8.0 (API level 26) and above.

    Declaration
    public GroupAlertBehaviours GroupAlertBehaviour { get; set; }
    Property Value
    Type Description
    GroupAlertBehaviours

    GroupSummary

    Set this notification to be the group summary for a group of notifications. Requires the 'Group' property to also be set. Grouped notifications may display in a cluster or stack on devices which support such rendering. Only available on Android 7.0 (API level 24) and above.

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

    IntentData

    Use this to save arbitrary string data related to the notification.

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

    LargeIcon

    Notification large icon. Add a large icon to the notification content view. This image will be shown on the left of the notification view in place of the small icon (which will be placed in a small badge atop the large icon). The icon has to be registered in Notification Settings or a PNG file has to be placed in the res/drawable folder of the Android library plugin and it's name has to be specified without the extension. Alternatively it can be a file path or system supported URI.

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

    Number

    Sets the number of items this notification represents. Is displayed as a badge count on the notification icon if the launcher supports this behavior.

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

    RepeatInterval

    The notification will be be repeated on every specified time interval. Do not set for one time notifications.

    Declaration
    public TimeSpan? RepeatInterval { get; set; }
    Property Value
    Type Description
    TimeSpan?

    ShouldAutoCancel

    This notification will automatically be dismissed when the user touches it. By default this behavior is turned off.

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

    ShowInForeground

    Set this notification to be shown when app is in the foreground (default: true).

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

    ShowTimestamp

    Enable it to show a timestamp on the notification when it's delivered, unless the "CustomTimestamp" property is set "FireTime" will be shown.

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

    SmallIcon

    Notification small icon. It will be used to represent the notification in the status bar and content view (unless overridden there by a large icon) The icon has to be registered in Notification Settings or a PNG file has to be placed in the res/drawable folder of the Android library plugin and it's name has to be specified without the extension. Alternatively it can also be URI supported by the OS.

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

    SortKey

    The sort key will be used to order this notification among other notifications from the same package. Notifications will be sorted lexicographically using this value.

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

    Style

    Apply a custom style to the notification. Currently only BigPicture and BigText styles are supported.

    Declaration
    public NotificationStyle Style { get; set; }
    Property Value
    Type Description
    NotificationStyle

    Text

    Notification body. Set the second line of text in the notification.

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

    Title

    Notification title. Set the first line of text in the notification.

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

    UsesStopwatch

    Show the notification time field as a stopwatch instead of a timestamp.

    Declaration
    public bool UsesStopwatch { get; set; }
    Property Value
    Type Description
    bool
    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)