string | The title of the notification. | 1.0.0 |
-| **`body`** | string | The body of the notification, shown below the title. | 1.0.0 |
-| **`largeBody`** | string | Sets a multiline text block for display in a big text notification style. | 1.0.0 |
-| **`summaryText`** | string | Used to set the summary text detail in inbox and big text notification styles. Only available for Android. | 1.0.0 |
-| **`id`** | number | The notification identifier. | 1.0.0 |
-| **`schedule`** | Schedule | Schedule this notification for a later time. | 1.0.0 |
-| **`sound`** | string | Name of the audio file to play when this notification is displayed. Include the file extension with the filename. On iOS, the file should be in the app bundle. On Android, the file should be in res/raw folder. Recommended format is `.wav` because is supported by both iOS and Android. Only available for iOS and Android < 26. For Android 26+ use channelId of a channel configured with the desired sound. If the sound file is not found, (i.e. empty string or wrong name) the default system notification sound will be used. If not provided, it will produce the default sound on Android and no sound on iOS. | 1.0.0 |
-| **`smallIcon`** | string | Set a custom status bar icon. If set, this overrides the `smallIcon` option from Capacitor configuration. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android. | 1.0.0 |
-| **`largeIcon`** | string | Set a large icon for notifications. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android. | 1.0.0 |
-| **`iconColor`** | string | Set the color of the notification icon. Only available for Android. | 1.0.0 |
-| **`attachments`** | Attachment[] | Set attachments for this notification. | 1.0.0 |
-| **`actionTypeId`** | string | Associate an action type with this notification. | 1.0.0 |
-| **`extra`** | any | Set extra data to store within this notification. | 1.0.0 |
-| **`threadIdentifier`** | string | Used to group multiple notifications. Sets `threadIdentifier` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS. | 1.0.0 |
-| **`summaryArgument`** | string | The string this notification adds to the category's summary format string. Sets `summaryArgument` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS. | 1.0.0 |
-| **`group`** | string | Used to group multiple notifications. Calls `setGroup()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android. | 1.0.0 |
-| **`groupSummary`** | boolean | If true, this notification becomes the summary for a group of notifications. Calls `setGroupSummary()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android when using `group`. | 1.0.0 |
-| **`channelId`** | string | Specifies the channel the notification should be delivered on. If channel with the given name does not exist then the notification will not fire. If not provided, it will use the default channel. Calls `setChannelId()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android 26+. | 1.0.0 |
-| **`ongoing`** | boolean | If true, the notification can't be swiped away. Calls `setOngoing()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android. | 1.0.0 |
-| **`autoCancel`** | boolean | If true, the notification is canceled when the user clicks on it. Calls `setAutoCancel()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android. | 1.0.0 |
-| **`inboxList`** | string[] | Sets a list of strings for display in an inbox style notification. Up to 5 strings are allowed. Only available for Android. | 1.0.0 |
+| Prop | Type | Description | Since |
+| ----------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
+| **`title`** | string | The title of the notification. | 1.0.0 |
+| **`body`** | string | The body of the notification, shown below the title. | 1.0.0 |
+| **`largeBody`** | string | Sets a multiline text block for display in a big text notification style. | 1.0.0 |
+| **`summaryText`** | string | Used to set the summary text detail in inbox and big text notification styles. Only available for Android. | 1.0.0 |
+| **`id`** | number | The notification identifier. | 1.0.0 |
+| **`schedule`** | Schedule | Schedule this notification for a later time. | 1.0.0 |
+| **`sound`** | string | Name of the audio file to play when this notification is displayed. Include the file extension with the filename. On iOS, the file should be in the app bundle. On Android, the file should be in res/raw folder. Recommended format is `.wav` because is supported by both iOS and Android. Only available for iOS and Android < 26. For Android 26+ use channelId of a channel configured with the desired sound. If the sound file is not found, (i.e. empty string or wrong name) the default system notification sound will be used. If not provided, it will produce the default sound on Android and no sound on iOS. | 1.0.0 |
+| **`smallIcon`** | string | Set a custom status bar icon. If set, this overrides the `smallIcon` option from Capacitor configuration. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android. | 1.0.0 |
+| **`largeIcon`** | string | Set a large icon for notifications. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android. | 1.0.0 |
+| **`iconColor`** | string | Set the color of the notification icon. Only available for Android. | 1.0.0 |
+| **`attachments`** | Attachment[] | Set attachments for this notification. | 1.0.0 |
+| **`actionTypeId`** | string | Associate an action type with this notification. | 1.0.0 |
+| **`extra`** | any | Set extra data to store within this notification. | 1.0.0 |
+| **`threadIdentifier`** | string | Used to group multiple notifications. Sets `threadIdentifier` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS. | 1.0.0 |
+| **`summaryArgument`** | string | The string this notification adds to the category's summary format string. Sets `summaryArgument` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS. | 1.0.0 |
+| **`group`** | string | Used to group multiple notifications. Calls `setGroup()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android. | 1.0.0 |
+| **`groupSummary`** | boolean | If true, this notification becomes the summary for a group of notifications. Calls `setGroupSummary()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android when using `group`. | 1.0.0 |
+| **`channelId`** | string | Specifies the channel the notification should be delivered on. If channel with the given name does not exist then the notification will not fire. If not provided, it will use the default channel. Calls `setChannelId()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android 26+. | 1.0.0 |
+| **`ongoing`** | boolean | If true, the notification can't be swiped away. Calls `setOngoing()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android. | 1.0.0 |
+| **`autoCancel`** | boolean | If true, the notification is canceled when the user clicks on it. Calls `setAutoCancel()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android. | 1.0.0 |
+| **`inboxList`** | string[] | Sets a list of strings for display in an inbox style notification. Up to 5 strings are allowed. Only available for Android. | 1.0.0 |
+| **`interruptionLevel`** | InterruptionLevel | Sets the interruption level for this notification. Only available for iOS. | 4.2.0 |
#### Schedule
@@ -707,4 +708,14 @@ The notification visibility. For more details, see the [Android Developer Docs](
| **`Friday`** | 6 |
| **`Saturday`** | 7 |
+
+#### InterruptionLevel
+
+| Members | Value |
+| -------------------- | -------------- |
+| **`PASSIVE`** | 0 |
+| **`ACTIVE`** | 1 |
+| **`TIME_SESIITIVE`** | 2 |
+| **`CRITICAL`** | 3 |
+
diff --git a/local-notifications/ios/Plugin/LocalNotificationsPlugin.swift b/local-notifications/ios/Plugin/LocalNotificationsPlugin.swift
index 1c255ecf9..ecaec41e2 100644
--- a/local-notifications/ios/Plugin/LocalNotificationsPlugin.swift
+++ b/local-notifications/ios/Plugin/LocalNotificationsPlugin.swift
@@ -239,6 +239,14 @@ public class LocalNotificationsPlugin: CAPPlugin {
content.attachments = try makeAttachments(attachments)
}
+ if #available(iOS 15, *) {
+ if let interruptionLevel = notification["interruptionLevel"] as? UInt {
+ if interruptionLevel <= 3 {
+ content.interruptionLevel = UNNotificationInterruptionLevel(rawValue: interruptionLevel)!
+ }
+ }
+ }
+
return content
}
diff --git a/local-notifications/src/definitions.ts b/local-notifications/src/definitions.ts
index 6f4cd472e..62db27601 100644
--- a/local-notifications/src/definitions.ts
+++ b/local-notifications/src/definitions.ts
@@ -738,6 +738,15 @@ export interface LocalNotificationSchema {
* @since 1.0.0
*/
inboxList?: string[];
+
+ /**
+ * Sets the interruption level for this notification.
+ *
+ * Only available for iOS.
+ *
+ * @since 4.2.0
+ */
+ interruptionLevel?: InterruptionLevel;
}
/**
@@ -824,6 +833,13 @@ export type ScheduleEvery =
| 'minute'
| 'second';
+export enum InterruptionLevel {
+ PASSIVE = 0,
+ ACTIVE = 1,
+ TIME_SESIITIVE = 2,
+ CRITICAL = 3,
+}
+
export interface ListChannelsResult {
/**
* The list of notification channels.