メインコンテンツまでスキップ
バージョン: v8

@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:

PropTypeDescriptionSince
smallIconstringSet 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
iconColorstringSet the default color of status bar icons for notifications. Only available for Android.1.0.0
soundstringSet 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
presentationOptionsLocalNotificationPresentationOption[]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 codePlatform(s)Description
OS-PLUG-LNOT-0001Android, iOSnotifications オプションに通知の配列を指定してください。
OS-PLUG-LNOT-0002Android, iOS通知に識別子がありません。
OS-PLUG-LNOT-0003iOS通知の内容を構築できません。
OS-PLUG-LNOT-0004iOSトリガーの構築に失敗したため、通知を作成できません。
OS-PLUG-LNOT-0005Android, iOSこのデバイスでは通知が有効になっていません。
OS-PLUG-LNOT-0006Android, iOS色の指定が無効です。16進数の文字列(例: #ff0000)を指定してください。
OS-PLUG-LNOT-0007Android通知の形式が無効です。
OS-PLUG-LNOT-0008Androidプラグインに渡した日付の形式が無効です。
OS-PLUG-LNOT-0009Android識別子は32ビット整数で指定してください。
OS-PLUG-LNOT-0010iOS通知を予約できません。
OS-PLUG-LNOT-0011Android, iOSnotifications には通知オブジェクトのリストを指定してください。
OS-PLUG-LNOT-0012Android, iOSids 配列を指定してください。
OS-PLUG-LNOT-0013iOS通知権限を要求できません。
OS-PLUG-LNOT-0014Androidプラグインに渡した JSON オブジェクトが無効です。
OS-PLUG-LNOT-0015Androidチャンネルに識別子がありません。
OS-PLUG-LNOT-0016Androidチャンネルに名前がありません。
OS-PLUG-LNOT-0017Android権限不足のため正確なアラームを予約できず、不正確なアラームとして予約しました。
OS-PLUG-LNOT-0018Android権限不足のため正確なアラームを予約できません。

API​

schedule(...)​

schedule(options: ScheduleOptions) => Promise<ScheduleResult>

Schedule one or more local notifications.

バージョン 8.3.0 以降、必要な通知権限がまだ付与されていない場合は、 予約前に権限を要求します。対象は Android 13 以降の POST_NOTIFICATIONS と iOS の UNUserNotificationCenter の認可です。 あらかじめ requestPermissions() を呼び出すアプリに影響はありません。

ParamType
options
ScheduleOptions

Returns:

Promise<ScheduleResult>

Since: 1.0.0


update(...)​

update(options: ScheduleOptions) => Promise<ScheduleResult>

予約済みのローカル通知を id に基づいて1件以上更新します。

現在予約されていない id は無視します。 schedule と同様に、必要に応じて通知権限を要求します。

ParamType
options
ScheduleOptions

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.

ParamType
options
RegisterActionTypesOptions

Since: 1.0.0


cancel(...)​

cancel(options: CancelOptions) => Promise<void>

Cancel pending notifications.

ParamType
options
CancelOptions

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.

ParamType
delivered
DeliveredNotifications

Since: 4.0.0


removeDeliveredNotificationsById(...)​

removeDeliveredNotificationsById(options: RemoveByIdsOptions) => Promise<void>

配信済みの通知のうち、指定した id に一致するものを 通知画面から削除します。

removeDeliveredNotifications に対応する、ID 指定のメソッドです。 OutSystems の ClearNotifications アクションなど、識別子だけを持つ呼び出し元からも 1回のメソッド呼び出しで削除できます。

ParamType
options
RemoveByIdsOptions

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>

指定した識別子に一致する通知を取得します。 配信待ちと配信済みのどちらも対象です。

ParamType
options
GetByIdsOptions

Returns:

Promise<GetNotificationsResult>

Since: 8.3.0


getAll(...)​

getAll(options?: GetAllOptions | undefined) => Promise<GetNotificationsResult>

プラグインが把握しているすべての通知を取得します。状態で絞り込むこともできます。

state を省略すると、配信待ちと配信済みの両方を返します。 SCHEDULED を指定すると配信待ちの通知を、 TRIGGERED を指定すると配信済みの通知を返します。

ParamType
options
GetAllOptions

Returns:

Promise<GetNotificationsResult>

Since: 8.3.0


createChannel(...)​

createChannel(channel: Channel) => Promise<void>

Create a notification channel.

Only available for Android.

ParamType
channel
Channel

Since: 1.0.0


deleteChannel(...)​

deleteChannel(args: { id: string; }) => Promise<void>

Delete a notification channel.

Only available for Android.

ParamType
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.

ParamType
eventName'localNotificationReceived'
listenerFunc
(notification: LocalNotificationSchema) => void

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.

ParamType
eventName'localNotificationActionPerformed'
listenerFunc
(notificationAction: ActionPerformed) => void

Returns:

Promise<PluginListenerHandle>

Since: 1.0.0


removeAllListeners()​

removeAllListeners() => Promise<void>

Remove all listeners for this plugin.

Since: 1.0.0


Interfaces​

ScheduleResult​

PropTypeDescriptionSince
notificationsLocalNotificationDescriptor[]予約済み通知の一覧。1.0.0
warning
ScheduleWarning
呼び出しに含まれる通知のうち1件でも isExactNotification が true(デフォルト)で、正確なアラームの権限がなく、不正確なアラームとして予約された場合に設定されます。update() の場合や、すべての該当通知が指定どおりの精度で予約された場合は含まれません。8.3.0

LocalNotificationDescriptor​

The object that describes a local notification.

PropTypeDescriptionSince
idnumberThe notification identifier.1.0.0

ScheduleWarning​

成功結果に付随する、致命的ではない警告。

PropTypeDescriptionSince
codestringOS-PLUG-LNOT-NNNN 形式の警告コード。8.3.0
messagestring警告の内容を説明するメッセージ。8.3.0

ScheduleOptions​

PropTypeDescriptionSince
notificationsLocalNotificationSchema[]The list of notifications to schedule.1.0.0

LocalNotificationSchema​

PropTypeDescriptionDefaultSince
titlestring通知のタイトル。1.0.0
bodystringタイトルの下に表示する通知本文。1.0.0
largeBodystring大きなテキスト形式の通知に表示する複数行のテキスト。1.0.0
summaryTextstring受信トレイ形式または大きなテキスト形式の通知に表示する要約。Android 専用です。1.0.0
idnumber通知の識別子。Android では32ビット整数のため、-2147483648 以上 2147483647 以下の値を指定してください。1.0.0
schedule
Schedule
この通知を後で配信するよう予約します。1.0.0
soundstring通知の表示時に再生する音声ファイル名を拡張子付きで指定します。iOS ではアプリバンドルに、Android では res/raw フォルダーに配置します。両方で使用できる .wav 形式を推奨します。iOS と Android 7.x 専用です。Android 8 以降は、目的の通知音を設定したチャンネルの channelId を使用します。ファイルが見つからない場合(空文字列や誤った名前など)はシステムのデフォルト通知音を使用します。未指定の場合、Android はデフォルト音、iOS は無音です。1.0.0
smallIconstringステータスバーのカスタムアイコン。指定すると Capacitor 設定の smallIcon を上書きします。アプリの res/drawable に配置し、拡張子を除いたファイル名を drawable リソース ID として指定します。Android 専用です。1.0.0
largeIconstring通知の大きなアイコン。アプリの res/drawable に配置し、拡張子を除いたファイル名を drawable リソース ID として指定します。Android 専用です。1.0.0
iconColorstring通知アイコンの色。Android 専用です。1.0.0
attachmentsAttachment[]通知に添付するファイルを設定します。1.0.0
actionTypeIdstring通知にアクションの種類を関連付けます。1.0.0
extraany通知に保存する追加データを設定します。1.0.0
threadIdentifierstring複数の通知をグループ化します。UNMutableNotificationContent の threadIdentifier を設定します。iOS 専用です。1.0.0
summaryArgumentstringカテゴリの要約フォーマット文字列に追加する文字列。UNMutableNotificationContent の summaryArgument を設定します。iOS 専用です。1.0.0
relevanceScorenumberシステムがアプリの通知をまとめるとき、代表として表示する通知を決めるスコア。0(最低)から1(最高)までを指定し、デフォルトは 0 です。UNMutableNotificationContent の relevanceScore を設定します。iOS 専用です。8.1.0
interruptionLevel
InterruptionLevel
通知の優先度と配信タイミングを示す割り込みレベル。UNMutableNotificationContent の interruptionLevel を設定します。iOS 専用です。8.1.0
groupstring複数の通知をグループ化します。指定値を渡して NotificationCompat.Builder の setGroup() を呼び出します。Android 専用です。1.0.0
groupSummarybooleantrue の場合、この通知をグループの要約にします。指定値で NotificationCompat.Builder の setGroupSummary() を呼び出します。Android で group を使用する場合のみ有効です。1.0.0
channelIdstring通知を配信するチャンネル。指定した名前のチャンネルが存在しない場合、通知は配信されません。省略するとデフォルトのチャンネルを使用します。指定値で NotificationCompat.Builder の setChannelId() を呼び出します。Android 8 以降専用です。1.0.0
ongoingbooleantrue の場合、通知をスワイプして消すことができません。指定値で NotificationCompat.Builder の setOngoing() を呼び出します。Android 専用です。1.0.0
autoCancelbooleantrue の場合、ユーザーがタップすると通知が消えます。指定値で NotificationCompat.Builder の setAutoCancel() を呼び出します。Android 専用です。1.0.0
inboxListstring[]受信トレイ形式の通知に表示する文字列のリスト。最大5件指定できます。Android 専用です。1.0.0
silentbooleantrue の場合、アプリがフォアグラウンドにある間は通知を表示しません。iOS 専用です。5.0.0
badgenumber配信時にアプリアイコンのバッジに表示する数。iOS は UNMutableNotificationContent のバッジ数を設定し、Android は NotificationCompat.Builder の setNumber() を呼び出します。8.3.0
foregroundbooleanフォアグラウンド時の通知表示を指定します。iOS で true を指定すると表示を強制し、false では表示を抑止します(localNotificationReceived リスナーには届きます)。silent とは独立しており、両方を指定すると foreground が優先されます。Android では通知の優先度を上げ、ヘッドアップ通知として表示できるようにします。8.3.0
isExactNotificationboolean正確なアラームとして予約するかどうか。Android 専用で、デフォルトは true です。API 31 以降で権限がない場合、schedule() は isExactMandatory にかかわらず「アラームとリマインダー」設定を開いて権限の付与を求めます。拒否された場合、通常は不正確なアラームとして予約し、ScheduleResult.warning を設定します。isExactMandatory も有効な場合は呼び出しが失敗します。update() は権限を要求せず、警告なしで不正確なアラームに切り替えます。false を指定すると権限にかかわらず最初から不正確なアラームとして予約します。true8.3.0
isExactMandatorybooleanこの通知に正確なアラームが必須かどうか。Android の schedule() で isExactNotification が true(デフォルト)の場合のみ有効です。権限が拒否され、予約対象の通知のうち1件でもこの値が true なら、不正確なアラームには切り替えず、schedule() の呼び出し全体が失敗します。update() はこの指定を適用せず、必須でない場合と同様に不正確なアラームに切り替えます。false8.3.0

Schedule​

Represents a schedule for a notification.

Use either at, on, or every to schedule notifications.

PropTypeDescriptionSince
at
Date
Schedule a notification at a specific date and time.1.0.0
repeatsbooleanRepeat delivery of this notification at the date and time specified by at. Only available for iOS and Android.1.0.0
allowWhileIdlebooleanAllow this notification to fire while in Doze Note that these notifications can only fire once per 9 minutes, per app.1.0.0
on
ScheduleOn
Schedule a notification on particular interval(s). This is similar to scheduling cron jobs. Only available for iOS and Android.1.0.0
every
ScheduleEvery
Schedule a notification on a particular interval.1.0.0
countnumberLimit 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.

MethodSignatureDescription
toString() => stringReturns a string representation of a date. The format of the string depends on the locale.
toDateString() => stringReturns a date as a string value.
toTimeString() => stringReturns a time as a string value.
toLocaleString() => stringReturns a value as a string value appropriate to the host environment's current locale.
toLocaleDateString() => stringReturns a date as a string value appropriate to the host environment's current locale.
toLocaleTimeString() => stringReturns a time as a string value appropriate to the host environment's current locale.
valueOf() => numberReturns the stored time value in milliseconds since midnight, January 1, 1970 UTC.
getTime() => numberGets the time value in milliseconds.
getFullYear() => numberGets the year, using local time.
getUTCFullYear() => numberGets the year using Universal Coordinated Time (UTC).
getMonth() => numberGets the month, using local time.
getUTCMonth() => numberGets the month of a Date object using Universal Coordinated Time (UTC).
getDate() => numberGets the day-of-the-month, using local time.
getUTCDate() => numberGets the day-of-the-month, using Universal Coordinated Time (UTC).
getDay() => numberGets the day of the week, using local time.
getUTCDay() => numberGets the day of the week using Universal Coordinated Time (UTC).
getHours() => numberGets the hours in a date, using local time.
getUTCHours() => numberGets the hours value in a Date object using Universal Coordinated Time (UTC).
getMinutes() => numberGets the minutes of a Date object, using local time.
getUTCMinutes() => numberGets the minutes of a Date object using Universal Coordinated Time (UTC).
getSeconds() => numberGets the seconds of a Date object, using local time.
getUTCSeconds() => numberGets the seconds of a Date object using Universal Coordinated Time (UTC).
getMilliseconds() => numberGets the milliseconds of a Date, using local time.
getUTCMilliseconds() => numberGets the milliseconds of a Date object using Universal Coordinated Time (UTC).
getTimezoneOffset() => numberGets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).
setTime(time: number) => numberSets the date and time value in the Date object.
setMilliseconds(ms: number) => numberSets the milliseconds value in the Date object using local time.
setUTCMilliseconds(ms: number) => numberSets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
setSeconds(sec: number, ms?: number | undefined) => numberSets the seconds value in the Date object using local time.
setUTCSeconds(sec: number, ms?: number | undefined) => numberSets the seconds value in the Date object using Universal Coordinated Time (UTC).
setMinutes(min: number, sec?: number | undefined, ms?: number | undefined) => numberSets the minutes value in the Date object using local time.
setUTCMinutes(min: number, sec?: number | undefined, ms?: number | undefined) => numberSets the minutes value in the Date object using Universal Coordinated Time (UTC).
setHours(hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => numberSets the hour value in the Date object using local time.
setUTCHours(hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => numberSets the hours value in the Date object using Universal Coordinated Time (UTC).
setDate(date: number) => numberSets the numeric day-of-the-month value of the Date object using local time.
setUTCDate(date: number) => numberSets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
setMonth(month: number, date?: number | undefined) => numberSets the month value in the Date object using local time.
setUTCMonth(month: number, date?: number | undefined) => numberSets the month value in the Date object using Universal Coordinated Time (UTC).
setFullYear(year: number, month?: number | undefined, date?: number | undefined) => numberSets the year of the Date object using local time.
setUTCFullYear(year: number, month?: number | undefined, date?: number | undefined) => numberSets the year value in the Date object using Universal Coordinated Time (UTC).
toUTCString() => stringReturns a date converted to a string using Universal Coordinated Time (UTC).
toISOString() => stringReturns a date as a string value in ISO format.
toJSON(key?: any) => stringUsed by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.

ScheduleOn​

PropType
yearnumber
monthnumber
daynumber
weekday
Weekday
hournumber
minutenumber
secondnumber

Attachment​

Represents a notification attachment.

PropTypeDescriptionSince
idstringThe attachment identifier.1.0.0
urlstringThe 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
AttachmentOptions
Attachment options.1.0.0

AttachmentOptions​

PropTypeDescriptionSince
iosUNNotificationAttachmentOptionsTypeHintKeystringSets the UNNotificationAttachmentOptionsTypeHintKey key in the hashable options of UNNotificationAttachment. Only available for iOS.1.0.0
iosUNNotificationAttachmentOptionsThumbnailHiddenKeystringSets the UNNotificationAttachmentOptionsThumbnailHiddenKey key in the hashable options of UNNotificationAttachment. Only available for iOS.1.0.0
iosUNNotificationAttachmentOptionsThumbnailClippingRectKeystringSets the UNNotificationAttachmentOptionsThumbnailClippingRectKey key in the hashable options of UNNotificationAttachment. Only available for iOS.1.0.0
iosUNNotificationAttachmentOptionsThumbnailTimeKeystringSets the UNNotificationAttachmentOptionsThumbnailTimeKey key in the hashable options of UNNotificationAttachment. Only available for iOS.1.0.0

PendingResult​

PropTypeDescriptionSince
notificationsPendingLocalNotificationSchema[]The list of pending notifications.1.0.0

PendingLocalNotificationSchema​

PropTypeDescriptionSince
titlestringThe title of the notification.1.0.0
bodystringThe body of the notification, shown below the title.1.0.0
idnumberThe notification identifier.1.0.0
schedule
Schedule
Schedule this notification for a later time.1.0.0
extraanySet extra data to store within this notification.1.0.0

RegisterActionTypesOptions​

PropTypeDescriptionSince
typesActionType[]The list of action types to register.1.0.0

ActionType​

A collection of actions.

PropTypeDescriptionSince
idstringThe ID of the action type. Referenced in notifications by the actionTypeId key.1.0.0
actionsAction[]The list of actions associated with this action type.1.0.0
iosHiddenPreviewsBodyPlaceholderstringSets hiddenPreviewsBodyPlaceholder of the UNNotificationCategory. Only available for iOS.1.0.0
iosCustomDismissActionbooleanSets customDismissAction in the options of the UNNotificationCategory. Only available for iOS.1.0.0
iosAllowInCarPlaybooleanSets allowInCarPlay in the options of the UNNotificationCategory. Only available for iOS.1.0.0
iosHiddenPreviewsShowTitlebooleanSets hiddenPreviewsShowTitle in the options of the UNNotificationCategory. Only available for iOS.1.0.0
iosHiddenPreviewsShowSubtitlebooleanSets 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.

PropTypeDescriptionSince
idstringThe action identifier. Referenced in the 'actionPerformed' event as actionId.1.0.0
titlestringThe title text to display for this action.1.0.0
requiresAuthenticationbooleanSets authenticationRequired in the options of the UNNotificationAction. Only available for iOS.1.0.0
foregroundbooleanSets foreground in the options of the UNNotificationAction. Only available for iOS.1.0.0
destructivebooleanSets destructive in the options of the UNNotificationAction. Only available for iOS.1.0.0
inputbooleanUse a UNTextInputNotificationAction instead of a UNNotificationAction. Only available for iOS.1.0.0
inputButtonTitlestringSets textInputButtonTitle on the UNTextInputNotificationAction. Only available for iOS when input is true.1.0.0
inputPlaceholderstringSets textInputPlaceholder on the UNTextInputNotificationAction. Only available for iOS when input is true.1.0.0

CancelOptions​

PropTypeDescriptionSince
notificationsLocalNotificationDescriptor[]The list of notifications to cancel.1.0.0

EnabledResult​

PropTypeDescriptionSince
valuebooleanWhether or not the device has local notifications enabled.1.0.0

DeliveredNotifications​

PropTypeDescriptionSince
notificationsDeliveredNotificationSchema[]List of notifications that are visible on the notifications screen.1.0.0

DeliveredNotificationSchema​

PropTypeDescriptionSince
idnumberThe notification identifier.4.0.0
tagstringThe notification tag. Only available on Android.4.0.0
titlestringThe title of the notification.4.0.0
bodystringThe body of the notification, shown below the title.4.0.0
groupstringThe configured group of the notification. Only available for Android.4.0.0
groupSummarybooleanIf this notification is the summary for a group of notifications. Only available for Android.4.0.0
dataanyAny additional data that was included in the notification payload. Only available for Android.4.0.0
extraanyExtra data to store within this notification. Only available for iOS.4.0.0
attachmentsAttachment[]The attachments for this notification. Only available for iOS.1.0.0
actionTypeIdstringAction type ssociated with this notification. Only available for iOS.4.0.0
schedule
Schedule
Schedule used to fire this notification. Only available for iOS.4.0.0
soundstringSound that was used when the notification was displayed. Only available for iOS.4.0.0

RemoveByIdsOptions​

PropTypeDescriptionSince
idsnumber[]削除する配信済み通知の識別子。8.3.0

GetNotificationsResult​

PropTypeDescriptionSince
notificationsLocalNotificationSchema[]クエリに一致する通知の一覧。8.3.0

GetByIdsOptions​

PropTypeDescriptionSince
idsnumber[]取得する通知の識別子。8.3.0

GetAllOptions​

PropTypeDescriptionSince
state
NotificationState
返す通知を状態で絞り込みます。省略すると、配信待ちと配信済みの両方を返します。8.3.0

Channel​

PropTypeDescriptionDefaultSince
idstringThe channel identifier.1.0.0
namestringThe human-friendly name of this channel (presented to the user).1.0.0
descriptionstringThe description of this channel (presented to the user).1.0.0
soundstringThe sound that should be played for notifications posted to this channel. Notification channels with an importance of at least 3 should have a sound. The file name of a sound file should be specified relative to the android app res/raw directory. If the sound is not provided, or the sound file is not found no sound will be used.1.0.0
importance
Importance
The level of interruption for notifications posted to this channel.
3
1.0.0
visibility
Visibility
The visibility of notifications posted to this channel. This setting is for whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form.1.0.0
lightsbooleanWhether notifications posted to this channel should display notification lights, on devices that support it.1.0.0
lightColorstringThe light color for notifications posted to this channel. Only supported if lights are enabled on this channel and the device supports it. Supported color formats are #RRGGBB and #RRGGBBAA.1.0.0
vibrationbooleanWhether notifications posted to this channel should vibrate.1.0.0

ListChannelsResult​

PropTypeDescriptionSince
channelsChannel[]The list of notification channels.1.0.0

PermissionStatus​

PropTypeDescriptionSince
display
PermissionState
Permission state of displaying notifications.1.0.0

SettingsPermissionStatus​

PropTypeDescriptionSince
exact_alarm
PermissionState
Permission state of using exact alarms.6.0.0

PluginListenerHandle​

PropType
remove() => Promise<void>

ActionPerformed​

PropTypeDescriptionSince
actionIdstringThe identifier of the performed action.1.0.0
inputValuestringThe value entered by the user on the notification. Only available on iOS for notifications with input set to true.1.0.0
notification
LocalNotificationSchema
The original notification schema.1.0.0

Type Aliases​

ScheduleEvery​

'year' | 'month' | 'two-weeks' | 'week' | 'day' | 'hour' | 'minute' | 'second'

InterruptionLevel​

The interruption level that indicates the priority and delivery timing of a notification.

  • active: The system presents the notification immediately, lights up the screen, and can play a sound.
  • critical: The system presents the notification immediately, lights up the screen, and bypasses the mute switch to play a sound. Requires the Critical Alerts entitlement.
  • passive: The system adds the notification to the notification list without lighting up the screen or playing a sound.
  • timeSensitive: The system presents the notification immediately, lights up the screen, can play a sound, and breaks through system notification controls. Requires the Time Sensitive Notifications capability. Without it, the notification may not break through stricter Focus modes such as Do Not Disturb. Even with the capability, the user can disable Time Sensitive notifications per Focus mode in Settings. See Time Sensitive notifications for more details.

'active' | 'critical' | 'passive' | 'timeSensitive'

NotificationState​

getAll の絞り込みに使用する通知の状態。

  • SCHEDULED: 配信待ちの通知。
  • TRIGGERED: 配信済みの通知。

'SCHEDULED' | 'TRIGGERED'

Importance​

The importance level. For more details, see the Android Developer Docs

0 | 1 | 2 | 3 | 4 | 5

Visibility​

The notification visibility. For more details, see the Android Developer Docs

-1 | 0 | 1

PermissionState​

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

Enums​

Weekday​

MembersValue
Sunday1
Monday2
Tuesday3
Wednesday4
Thursday5
Friday6
Saturday7