A NotificationsCategory
class encapsulates information about custom actions
that an app can perform in response to a local or push notification. Each instance of this
class represents a group of actions to display in conjunction with a single notification.
To display a group of actions for a specific notification, configure the local or push
notification with the category name of the group. For local notifications, you specify this
name when configuring your LocalNotification
object. For push notifications, your
server specifies a group of actions by complementing the push notification’s payload with a
category key (whose value is the identifier of the group). Push notifications received without
a notification category are displayed as plain notifications, with no additional
actions.
Action buttons are displayed in an order defined in the
setActions()
call.
On Android, only up to 3 actions can be presented. On iOS, depending on the type of presentation and the device receiving the notification, 2 or 4 actions can be presented.
You can obtain an instance of the NotificationsCategory
object by using the following
definition.
[Constructor(identifier: String)] interface NotificationCategory { // Identifies action group displayed, when notification is received. It must be sent in notification payload. attribute readonly identifier: String // Actions to display when notification is received. attribute readonly actions: Array<NotificationAction> // Sets the actions to display when notification is received. // Platform limitations: // - Android: up to 3 actions are supported. // - iOS: up to 4 actions are supported. setActions(action, ...) -> void }