@capacitor/local-notifications
The Local Notifications API provides a way to schedule device notifications locally (i.e. without a server sending push notifications).
Install
npm install @capacitor/local-notifications
npx cap sync
Android
Android 13 requires a permission check in order to send notifications. You are required to call checkPermissions() and requestPermissions() accordingly.
On Android 12 and older it won't show a prompt and will just return as granted.
Starting on Android 12, scheduled notifications won't be exact unless this permission is added to your AndroidManifest.xml:
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
Note that even if the permission is present, users can still disable exact notifications from the app settings. Use checkExactNotificationSetting() to check the the value of the setting. If a user disables this setting, the app will restart and any notification scheduled with an exact alarm will be deleted. If your application depends on exact alarms, be sure to check this setting on app launch (for example, in App.appStateChange) in order to provide fallbacks or alternative behavior.
On Android 14, there is a new permission called USE_EXACT_ALARM. Use this permission to use exact alarms without needing to request permission from the user. This should only be used if the use of exact alarms is central to your app's functionality. Read more about the implications of using this permission here.
From Android 15 onwards, users can install an app in the Private space. Users can lock their private space at any time, which means that push notifications are not shown until the user unlocks it.
It is not possible to detect if an app is installed in the private space. Therefore, if your app shows any critical notifications, inform your users to avoid installing the app in the private space.
For more information about the behavior changes of your app related to the private space, refer to Android documentation.
Configuration
The Local Notifications can be configured with the following options:
| Prop | Type | Description | Since |
|---|---|---|---|
smallIcon | string | Set the default status bar 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 default color of status bar icons for notifications. Only available for Android. | 1.0.0 |
sound | string | Set the default notification sound for notifications. On Android 8+ it sets the default channel sound and can't be changed unless the app is uninstalled. If the audio file is not found, it will result in the default system sound being played on Android 7.x and no sound on Android 8+. Only available for Android. | 1.0.0 |
presentationOptions | LocalNotificationPresentationOption[] | This is an array of strings you can combine. Possible values in the array are: - badge: badge count on the app icon is updated (default value) - sound: the device will ring/vibrate when the notification is received - banner: the notification is displayed as a banner - list: the notification is displayed in the notification center An empty array can be provided if none of the options are desired. Only available for iOS. | 8.2.0 |
Examples
In capacitor.config.json:
{
"plugins": {
"LocalNotifications": {
"smallIcon": "ic_stat_icon_config_sample",
"iconColor": "#488AFF",
"sound": "beep.wav",
"presentationOptions": ["badge", "sound", "banner", "list"]
}
}
}
In capacitor.config.ts:
/// <reference types="@capacitor/local-notifications" />
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
plugins: {
LocalNotifications: {
smallIcon: "ic_stat_icon_config_sample",
iconColor: "#488AFF",
sound: "beep.wav",
presentationOptions: ["badge", "sound", "banner", "list"],
},
},
};
export default config;
Doze
If the device has entered Doze mode, your application may have restricted capabilities. If you need your notification to fire even during Doze, schedule your notification by using allowWhileIdle: true. Make use of allowWhileIdle judiciously, as these notifications can only fire once per 9 minutes, per app.
Errors
バージョン 8.3.0 以降、Android と iOS では構造化されたエラーを返します。各エラーには code(例: OS-PLUG-LNOT-0001)と、内容を説明する message があります。0001、0002、0005、0006、0011、0012 は両プラットフォームで共通の意味を持ち、ほかのコードはプラットフォーム固有です。
| Error code | Platform(s) | Description |
|---|---|---|
| OS-PLUG-LNOT-0001 | Android, iOS | notifications オプションに通知の配列を指定してください。 |
| OS-PLUG-LNOT-0002 | Android, iOS | 通知に識別子がありません。 |
| OS-PLUG-LNOT-0003 | iOS | 通知の内容を構築できません。 |
| OS-PLUG-LNOT-0004 | iOS | トリガーの構築に失敗したため、通知を作成できません。 |
| OS-PLUG-LNOT-0005 | Android, iOS | このデバイスでは通知が有効になっていません。 |
| OS-PLUG-LNOT-0006 | Android, iOS | 色の指定が無効です。16進数の文字列(例: #ff0000)を指定してください。 |
| OS-PLUG-LNOT-0007 | Android | 通知の形式が無効です。 |
| OS-PLUG-LNOT-0008 | Android | プラグインに渡した日付の形式が無効です。 |
| OS-PLUG-LNOT-0009 | Android | 識別子は32ビット整数で指定してください。 |
| OS-PLUG-LNOT-0010 | iOS | 通知を予約できません。 |
| OS-PLUG-LNOT-0011 | Android, iOS | notifications には通知オブジェクトのリストを指定してください。 |
| OS-PLUG-LNOT-0012 | Android, iOS | ids 配列を指定してください。 |
| OS-PLUG-LNOT-0013 | iOS | 通知権限を要求できません。 |
| OS-PLUG-LNOT-0014 | Android | プラグインに渡した JSON オブジェクトが無効です。 |
| OS-PLUG-LNOT-0015 | Android | チャンネルに識別子がありません。 |
| OS-PLUG-LNOT-0016 | Android | チャンネルに名前がありません。 |
| OS-PLUG-LNOT-0017 | Android | 権限不足のため正確なアラームを予約できず、不正確な アラームとして予約しました。 |
| OS-PLUG-LNOT-0018 | Android | 権限不足のため正確なアラームを予約できません。 |
API
schedule(...)update(...)getPending()registerActionTypes(...)cancel(...)cancelAll()areEnabled()getDeliveredNotifications()removeDeliveredNotifications(...)removeDeliveredNotificationsById(...)removeAllDeliveredNotifications()getByIds(...)getAll(...)createChannel(...)deleteChannel(...)listChannels()checkPermissions()requestPermissions()changeExactNotificationSetting()checkExactNotificationSetting()addListener('localNotificationReceived', ...)addListener('localNotificationActionPerformed', ...)removeAllListeners()- Interfaces
- Type Aliases
- Enums
schedule(...)
schedule(options: ScheduleOptions) => Promise<ScheduleResult>
Schedule one or more local notifications.
バージョン 8.3.0 以降、必要な通知権限がまだ付与されていない場合は、
予約前に権限を要求します。対象は Android 13 以降の
POST_NOTIFICATIONS と iOS の UNUserNotificationCenter の認可です。
あらかじめ requestPermissions() を呼び出すアプリに影響はありません。
| Param | Type |
|---|---|
options | |
Returns:
Promise<ScheduleResult>
Since: 1.0.0
update(...)
update(options: ScheduleOptions) => Promise<ScheduleResult>
予約済みのローカル通知を id に基づいて1件以上更新します。
現在予約されていない id は無視します。
schedule と同様に、必要に応じて通知権限を要求します。
| Param | Type |
|---|---|
options | |
Returns:
Promise<ScheduleResult>
Since: 8.3.0
getPending()
getPending() => Promise<PendingResult>
Get a list of pending notifications.
Returns:
Promise<PendingResult>
Since: 1.0.0
registerActionTypes(...)
registerActionTypes(options: RegisterActionTypesOptions) => Promise<void>
Register actions to take when notifications are displayed.
Only available for iOS and Android.
| Param | Type |
|---|---|
options | |
Since: 1.0.0
cancel(...)
cancel(options: CancelOptions) => Promise<void>
Cancel pending notifications.
| Param | Type |
|---|---|
options | |
Since: 1.0.0
cancelAll()
cancelAll() => Promise<void>
配信待ちの通知をすべてキャンセルします。
Since: 8.3.0
areEnabled()
areEnabled() => Promise<EnabledResult>
Check if notifications are enabled or not.
Returns:
Promise<EnabledResult>
Since: 1.0.0
getDeliveredNotifications()
getDeliveredNotifications() => Promise<DeliveredNotifications>
Get a list of notifications that are visible on the notifications screen.
Returns:
Promise<DeliveredNotifications>
Since: 4.0.0
removeDeliveredNotifications(...)
removeDeliveredNotifications(delivered: DeliveredNotifications) => Promise<void>
Remove the specified notifications from the notifications screen.
| Param | Type |
|---|---|
delivered | |
Since: 4.0.0
removeDeliveredNotificationsById(...)
removeDeliveredNotificationsById(options: RemoveByIdsOptions) => Promise<void>
配信済みの通知のうち、指定した id に一致するものを
通知画面から削除します。
removeDeliveredNotifications に対応する、ID 指定のメソッドです。
OutSystems の ClearNotifications アクションなど、識別子だけを持つ呼び出し元からも
1回のメソッド呼び出しで削除できます。
| Param | Type |
|---|---|
options | |
Since: 8.3.0
removeAllDeliveredNotifications()
removeAllDeliveredNotifications() => Promise<void>
Remove all the notifications from the notifications screen.
Since: 4.0.0
getByIds(...)
getByIds(options: GetByIdsOptions) => Promise<GetNotificationsResult>
指定した識別子に一致する通知を取得します。 配信待ちと配信済みのどちらも対象です。
| Param | Type |
|---|---|
options | |
Returns:
Promise<GetNotificationsResult>
Since: 8.3.0
getAll(...)
getAll(options?: GetAllOptions | undefined) => Promise<GetNotificationsResult>
プラグインが把握しているすべての通知を取得します。状態で絞り込むこともできます。
state を省略すると、配信待ちと配信済みの両方を返します。
SCHEDULED を指定すると配信待ちの通知を、
TRIGGERED を指定すると配信済みの通知を返します。
| Param | Type |
|---|---|
options | |
Returns:
Promise<GetNotificationsResult>
Since: 8.3.0
createChannel(...)
createChannel(channel: Channel) => Promise<void>
Create a notification channel.
Only available for Android.
| Param | Type |
|---|---|
channel | |
Since: 1.0.0
deleteChannel(...)
deleteChannel(args: { id: string; }) => Promise<void>
Delete a notification channel.
Only available for Android.
| Param | Type |
|---|---|
args | { id: string; } |
Since: 1.0.0
listChannels()
listChannels() => Promise<ListChannelsResult>
Get a list of notification channels.
Only available for Android.
Returns:
Promise<ListChannelsResult>
Since: 1.0.0
checkPermissions()
checkPermissions() => Promise<PermissionStatus>
Check permission to display local notifications.
Returns:
Promise<PermissionStatus>
Since: 1.0.0
requestPermissions()
requestPermissions() => Promise<PermissionStatus>
Request permission to display local notifications.
Returns:
Promise<PermissionStatus>
Since: 1.0.0
changeExactNotificationSetting()
changeExactNotificationSetting() => Promise<SettingsPermissionStatus>
Direct user to the application settings screen to configure exact alarms.
In the event that a user changes the settings from granted to denied, the application will restart and any notification scheduled with an exact alarm will be deleted.
On Android < 12, the user will NOT be directed to the application settings screen, instead this function will
return granted.
Only available on Android.
Returns:
Promise<SettingsPermissionStatus>
Since: 6.0.0
checkExactNotificationSetting()
checkExactNotificationSetting() => Promise<SettingsPermissionStatus>
Check application setting for using exact alarms.
Only available on Android.
Returns:
Promise<SettingsPermissionStatus>
Since: 6.0.0
addListener('localNotificationReceived', ...)
addListener(eventName: 'localNotificationReceived', listenerFunc: (notification: LocalNotificationSchema) => void) => Promise<PluginListenerHandle>
Listen for when notifications are displayed.
| Param | Type |
|---|---|
eventName | 'localNotificationReceived' |
listenerFunc | |
Returns:
Promise<PluginListenerHandle>
Since: 1.0.0
addListener('localNotificationActionPerformed', ...)
addListener(eventName: 'localNotificationActionPerformed', listenerFunc: (notificationAction: ActionPerformed) => void) => Promise<PluginListenerHandle>
Listen for when an action is performed on a notification.
| Param | Type |
|---|---|
eventName | 'localNotificationActionPerformed' |
listenerFunc | |
Returns:
Promise<PluginListenerHandle>
Since: 1.0.0
removeAllListeners()
removeAllListeners() => Promise<void>
Remove all listeners for this plugin.
Since: 1.0.0
Interfaces
ScheduleResult
| Prop | Type | Description | Since |
|---|---|---|---|
notifications | LocalNotificationDescriptor[] | 予約済み通知の一覧。 | 1.0.0 |
warning | | 呼び出しに含まれる通知のうち1件でも isExactNotification が true(デフォルト)で、正確なアラームの権限がなく、不正確なアラームとして予約された場合に設定されます。update() の場合や、すべての該当通知が指定どおりの精度で予約された場合は含まれません。 | 8.3.0 |
LocalNotificationDescriptor
The object that describes a local notification.
| Prop | Type | Description | Since |
|---|---|---|---|
id | number | The notification identifier. | 1.0.0 |
ScheduleWarning
成功結果に付随する、致命的ではない警告。
| Prop | Type | Description | Since |
|---|---|---|---|
code | string | OS-PLUG-LNOT-NNNN 形式の警告コード。 | 8.3.0 |
message | string | 警告の内容を説明するメッセージ。 | 8.3.0 |
ScheduleOptions
| Prop | Type | Description | Since |
|---|---|---|---|
notifications | LocalNotificationSchema[] | The list of notifications to schedule. | 1.0.0 |
LocalNotificationSchema
| Prop | Type | Description | Default | Since |
|---|---|---|---|---|
title | string | 通知のタイトル。 | 1.0.0 | |
body | string | タイトルの下に表示する通知本文。 | 1.0.0 | |
largeBody | string | 大きなテキスト形式の通知に表示する複数行のテキスト。 | 1.0.0 | |
summaryText | string | 受信トレイ形式または大きなテ キスト形式の通知に表示する要約。Android 専用です。 | 1.0.0 | |
id | number | 通知の識別子。Android では32ビット整数のため、-2147483648 以上 2147483647 以下の値を指定してください。 | 1.0.0 | |
schedule | | この通知を後で配信するよう予約します。 | 1.0.0 | |
sound | string | 通知の表示時に再生する音声ファイル名を拡張子付きで指定します。iOS ではアプリバンドルに、Android では res/raw フォルダーに配置します。両方で使用できる .wav 形式を推奨します。iOS と Android 7.x 専用です。Android 8 以降は、目的の通知音を設定したチャンネルの channelId を使用します。ファイルが見つからない場合(空文字列や誤った名前など)はシステムのデフォルト通知音を使用します。未指定の場合、Android はデフォルト音、iOS は無音です。 | 1.0.0 | |
smallIcon | string | ステータスバーのカスタムアイコン。指定すると Capacitor 設定の smallIcon を上書きします。アプリの res/drawable に配置し、拡張子を除いたファイル名を drawable リソース ID として指定します。Android 専用です。 | 1.0.0 | |
largeIcon | string | 通知の大きなアイコン。アプリの res/drawable に配置し、拡張子を除いたファイル名を drawable リソース ID として指定します。Android 専用です。 | 1.0.0 | |
iconColor | string | 通知アイコンの色。Android 専用です。 | 1.0.0 | |
attachments | Attachment[] | 通知に添付するファイルを設定します。 | 1.0.0 | |
actionTypeId | string | 通知にアクションの種類を関連付けます。 | 1.0.0 | |
extra | any | 通知に保存する追加データを設定します。 | 1.0.0 | |
threadIdentifier | string | 複数の通知をグループ化します。UNMutableNotificationContent の threadIdentifier を設定します。iOS 専用です。 | 1.0.0 | |
summaryArgument | string | カテゴリの要約フォーマット文字列に追加する文字列。UNMutableNotificationContent の summaryArgument を設定します。iOS 専用です。 | 1.0.0 | |
relevanceScore | number | システムがアプリの通知をまとめるとき、代表として表示する通知を決めるスコア。0(最低)から1(最高)までを指定し、デフォルトは 0 です。UNMutableNotificationContent の relevanceScore を設定します。iOS 専用です。 | 8.1.0 | |
interruptionLevel | | 通知の優先度と配信タイミングを示す割り込みレベル。UNMutableNotificationContent の interruptionLevel を設定します。iOS 専用です。 | 8.1.0 | |
group | string | 複数の通知をグループ化します。指定値を渡して NotificationCompat.Builder の setGroup() を呼び出します。Android 専用です。 | 1.0.0 | |
groupSummary | boolean | true の場合、この通知をグループの要約にします。指定値で NotificationCompat.Builder の setGroupSummary() を呼び出します。Android で group を使用する場合のみ有効です。 | 1.0.0 | |
channelId | string | 通知を配信するチャンネル。指定した名前のチャンネルが存在しない場合、通知は配信されません。省略するとデフォルトのチャンネルを使用します。指定値で NotificationCompat.Builder の setChannelId() を呼び出します。Android 8 以降専用です。 | 1.0.0 | |
ongoing | boolean | true の場合、通知をスワイプして消すことができません。指定値で NotificationCompat.Builder の setOngoing() を呼び出します。Android 専用です。 | 1.0.0 | |
autoCancel | boolean | true の場合、ユーザーがタップすると通知が消えます。指定値で NotificationCompat.Builder の setAutoCancel() を呼び出します。Android 専用です。 | 1.0.0 | |
inboxList | string[] | 受信トレイ形式の通知に表示する文字列のリスト。最大5件指定できます。Android 専用です。 | 1.0.0 | |
silent | boolean | true の場合、アプリがフォアグラウンドにある間は通知を表示しません。iOS 専用です。 | 5.0.0 | |
badge | number | 配信時にアプリアイコンのバ ッジに表示する数。iOS は UNMutableNotificationContent のバッジ数を設定し、Android は NotificationCompat.Builder の setNumber() を呼び出します。 | 8.3.0 | |
foreground | boolean | フォアグラウンド時の通知表示を指定します。iOS で true を指定すると表示を強制し、false では表示を抑止します(localNotificationReceived リスナーには届きます)。silent とは独立しており、両方を指定すると foreground が優先されます。Android では通知の優先度を上げ、ヘッドアップ通知として表示できるようにします。 | 8.3.0 | |
isExactNotification | boolean | 正確なアラームとして予約するかどうか。Android 専用で、デフォルトは true です。API 31 以降で権限がない場合、schedule() は isExactMandatory にかかわらず「アラームとリマインダー」設定を開いて権限の付与を求めます。拒否された場合、通常は不正確なアラームとして予約し、ScheduleResult.warning を設定します。isExactMandatory も有効な場合は呼び出しが失敗します。update() は権限を要求せず、警告なしで不正確なアラームに切り替えます。false を指定すると権限にかかわらず最初から不正確なアラームとして予約します。 | true | 8.3.0 |
isExactMandatory | boolean | この通知に正確なアラームが必須かどうか。Android の schedule() で isExactNotification が true(デフォルト)の場合のみ有効です。権限が拒否され、予約対象の通知のうち1件でもこの値が true なら、不正確なアラームには切り替えず、schedule() の呼び出し全体が失敗します。update() はこの指定を適用せず、必須でない場合と同様に不正確なアラームに切り替えます。 | false | 8.3.0 |
Schedule
Represents a schedule for a notification.
Use either at, on, or every to schedule notifications.
| Prop | Type | Description | Since |
|---|---|---|---|
at | | Schedule a notification at a specific date and time. | 1.0.0 |
repeats | boolean | Repeat delivery of this notification at the date and time specified by at. Only available for iOS and Android. | 1.0.0 |
allowWhileIdle | boolean | Allow this notification to fire while in Doze Note that these notifications can only fire once per 9 minutes, per app. | 1.0.0 |
on | | Schedule a notification on particular interval(s). This is similar to scheduling cron jobs. Only available for iOS and Android. | 1.0.0 |
every | | Schedule a notification on a particular interval. | 1.0.0 |
count | number | Limit the number times a notification is delivered by the interval specified by every. | 1.0.0 |
Date
Enables basic storage and retrieval of dates and times.
| Method | Signature | Description |
|---|---|---|
| toString | () => string | Returns a string representation of a date. The format of the string depends on the locale. |
| toDateString | () => string | Returns a date as a string value. |
| toTimeString | () => string | Returns a time as a string value. |
| toLocaleString | () => string | Returns a value as a string value appropriate to the host environment's current locale. |
| toLocaleDateString | () => string | Returns a date as a string value appropriate to the host environment's current locale. |
| toLocaleTimeString | () => string | Returns a time as a string value appropriate to the host environment's current locale. |
| valueOf | () => number | Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. |
| getTime | () => number | Gets the time value in milliseconds. |
| getFullYear | () => number | Gets the year, using local time. |
| getUTCFullYear | () => number | Gets the year using Universal Coordinated Time (UTC). |
| getMonth | () => number | Gets the month, using local time. |
| getUTCMonth | () => number | Gets the month of a Date object using Universal Coordinated Time (UTC). |
| getDate | () => number | Gets the day-of-the-month, using local time. |
| getUTCDate | () => number | Gets the day-of-the-month, using Universal Coordinated Time (UTC). |
| getDay | () => number | Gets the day of the week, using local time. |
| getUTCDay | () => number | Gets the day of the week using Universal Coordinated Time (UTC). |
| getHours | () => number | Gets the hours in a date, using local time. |
| getUTCHours | () => number | Gets the hours value in a Date object using Universal Coordinated Time (UTC). |
| getMinutes | () => number | Gets the minutes of a Date object, using local time. |
| getUTCMinutes | () => number | Gets the minutes of a Date object using Universal Coordinated Time (UTC). |
| getSeconds | () => number | Gets the seconds of a Date object, using local time. |
| getUTCSeconds | () => number | Gets the seconds of a Date object using Universal Coordinated Time (UTC). |
| getMilliseconds | () => number | Gets the milliseconds of a Date, using local time. |
| getUTCMilliseconds | () => number | Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). |
| getTimezoneOffset | () => number | Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). |
| setTime | (time: number) => number | Sets the date and time value in the Date object. |
| setMilliseconds | (ms: number) => number | Sets the milliseconds value in the Date object using local time. |
| setUTCMilliseconds | (ms: number) => number | Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). |
| setSeconds | (sec: number, ms?: number | undefined) => number | Sets the seconds value in the Date object using local time. |
| setUTCSeconds | (sec: number, ms?: number | undefined) => number | Sets the seconds value in the Date object using Universal Coordinated Time (UTC). |
| setMinutes | (min: number, sec?: number | undefined, ms?: number | undefined) => number | Sets the minutes value in the Date object using local time. |
| setUTCMinutes | (min: number, sec?: number | undefined, ms?: number | undefined) => number | Sets the minutes value in the Date object using Universal Coordinated Time (UTC). |
| setHours | (hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => number | Sets the hour value in the Date object using local time. |
| setUTCHours | (hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => number | Sets the hours value in the Date object using Universal Coordinated Time (UTC). |
| setDate | (date: number) => number | Sets the numeric day-of-the-month value of the Date object using local time. |
| setUTCDate | (date: number) => number | Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). |
| setMonth | (month: number, date?: number | undefined) => number | Sets the month value in the Date object using local time. |
| setUTCMonth | (month: number, date?: number | undefined) => number | Sets the month value in the Date object using Universal Coordinated Time (UTC). |
| setFullYear | (year: number, month?: number | undefined, date?: number | undefined) => number | Sets the year of the Date object using local time. |
| setUTCFullYear | (year: number, month?: number | undefined, date?: number | undefined) => number | Sets the year value in the Date object using Universal Coordinated Time (UTC). |
| toUTCString | () => string | Returns a date converted to a string using Universal Coordinated Time (UTC). |
| toISOString | () => string | Returns a date as a string value in ISO format. |
| toJSON | (key?: any) => string | Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. |
ScheduleOn
| Prop | Type |
|---|---|
year | number |
month | number |
day | number |
weekday | |
hour | number |
minute | number |
second | number |
Attachment
Represents a notification attachment.
| Prop | Type | Description | Since |
|---|---|---|---|
id | string | The attachment identifier. | 1.0.0 |
url | string | The URL to the attachment. Use the res scheme to reference web assets, e.g. res:///assets/img/icon.png. Also accepts file URLs. | 1.0.0 |
options | | Attachment options. | 1.0.0 |
AttachmentOptions
| Prop | Type | Description | Since |
|---|---|---|---|
iosUNNotificationAttachmentOptionsTypeHintKey | string | Sets the UNNotificationAttachmentOptionsTypeHintKey key in the hashable options of UNNotificationAttachment. Only available for iOS. | 1.0.0 |
iosUNNotificationAttachmentOptionsThumbnailHiddenKey | string | Sets the UNNotificationAttachmentOptionsThumbnailHiddenKey key in the hashable options of UNNotificationAttachment. Only available for iOS. | 1.0.0 |
iosUNNotificationAttachmentOptionsThumbnailClippingRectKey | string | Sets the UNNotificationAttachmentOptionsThumbnailClippingRectKey key in the hashable options of UNNotificationAttachment. Only available for iOS. | 1.0.0 |
iosUNNotificationAttachmentOptionsThumbnailTimeKey | string | Sets the UNNotificationAttachmentOptionsThumbnailTimeKey key in the hashable options of UNNotificationAttachment. Only available for iOS. | 1.0.0 |
PendingResult
| Prop | Type | Description | Since |
|---|---|---|---|
notifications | PendingLocalNotificationSchema[] | The list of pending notifications. | 1.0.0 |
PendingLocalNotificationSchema
| 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 |
id | number | The notification identifier. | 1.0.0 |
schedule | | Schedule this notification for a later time. | 1.0.0 |
extra | any | Set extra data to store within this notification. | 1.0.0 |
RegisterActionTypesOptions
| Prop | Type | Description | Since |
|---|---|---|---|
types | ActionType[] | The list of action types to register. | 1.0.0 |
ActionType
A collection of actions.
| Prop | Type | Description | Since |
|---|---|---|---|
id | string | The ID of the action type. Referenced in notifications by the actionTypeId key. | 1.0.0 |
actions | Action[] | The list of actions associated with this action type. | 1.0.0 |
iosHiddenPreviewsBodyPlaceholder | string | Sets hiddenPreviewsBodyPlaceholder of the UNNotificationCategory. Only available for iOS. | 1.0.0 |
iosCustomDismissAction | boolean | Sets customDismissAction in the options of the UNNotificationCategory. Only available for iOS. | 1.0.0 |
iosAllowInCarPlay | boolean | Sets allowInCarPlay in the options of the UNNotificationCategory. Only available for iOS. | 1.0.0 |
iosHiddenPreviewsShowTitle | boolean | Sets hiddenPreviewsShowTitle in the options of the UNNotificationCategory. Only available for iOS. | 1.0.0 |
iosHiddenPreviewsShowSubtitle | boolean | Sets hiddenPreviewsShowSubtitle in the options of the UNNotificationCategory. Only available for iOS. | 1.0.0 |
Action
An action that can be taken when a notification is displayed.
| Prop | Type | Description | Since |
|---|---|---|---|
id | string | The action identifier. Referenced in the 'actionPerformed' event as actionId. | 1.0.0 |
title | string | The title text to display for this action. | 1.0.0 |
requiresAuthentication | boolean | Sets authenticationRequired in the options of the UNNotificationAction. Only available for iOS. | 1.0.0 |
foreground | boolean | Sets foreground in the options of the UNNotificationAction. Only available for iOS. | 1.0.0 |
destructive | boolean | Sets destructive in the options of the UNNotificationAction. Only available for iOS. | 1.0.0 |
input | boolean | Use a UNTextInputNotificationAction instead of a UNNotificationAction. Only available for iOS. | 1.0.0 |
inputButtonTitle | string | Sets textInputButtonTitle on the UNTextInputNotificationAction. Only available for iOS when input is true. | 1.0.0 |
inputPlaceholder | string | Sets textInputPlaceholder on the UNTextInputNotificationAction. Only available for iOS when input is true. | 1.0.0 |