{"_id":"@capacitor-ohos/local-notifications","_rev":"2-d2e2863a12ed5b459d970fd9877ea78a","name":"@capacitor-ohos/local-notifications","dist-tags":{"latest":"8.0.1"},"versions":{"8.0.0":{"name":"@capacitor-ohos/local-notifications","version":"8.0.0","keywords":["capacitor","plugin","native"],"author":{"url":"Group","name":"Huawei Device Co., Ltd and iSoftStone Information Technology"},"license":"MIT","_id":"@capacitor-ohos/local-notifications@8.0.0","maintainers":[{"name":"luqi_tan","email":"295099422@qq.com"}],"bugs":{"url":"https://gitcode.com/CPF-Ionic/capacitor-local-notifications/issues"},"dist":{"shasum":"46da01532abf330f0e79c5a59ff6770090c64dc9","tarball":"https://registry.npmjs.org/@capacitor-ohos/local-notifications/-/local-notifications-8.0.0.tgz","fileCount":13,"integrity":"sha512-p7UNxLcSd/x3HAX93Y7I823nads/xd9n7jI7XsrbAaEpcHCOQyoIGQGMDdgBHcwHpIdkCtlL3QlYIXgScMlG5g==","signatures":[{"sig":"MEQCIC2vIgjJqw6gl/jWMWNoAKnvUYN7TzAfeB/DuPe1udcnAiB/eJrxlT3TiB9fIqh+ur/Dj5+IX4DoSwK+MFRpfXKlSg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":114154},"gitHead":"ad7b4c3233bc32960fce95e7f5f7420d71c6602e","_npmUser":{"name":"luqi_tan","email":"295099422@qq.com"},"capacitor":{"id":"@capacitor/local-notifications","platforms":["openharmony"]},"repository":{"url":"gitcode:CPF-Ionic/capacitor-local-notifications","type":"git"},"_npmVersion":"10.5.1","description":"The Local Notifications API provides a way to schedule device notifications locally (i.e. without a server sending push notifications).","directories":{},"_nodeVersion":"22.0.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/local-notifications_8.0.0_1777546627944_0.5610381448983628","host":"s3://npm-registry-packages-npm-production"}},"8.0.1":{"name":"@capacitor-ohos/local-notifications","version":"8.0.1","description":"The Local Notifications API provides a way to schedule device notifications locally (i.e. without a server sending push notifications).","capacitor":{"id":"@capacitor/local-notifications","platforms":["openharmony"]},"repository":{"type":"git","url":"gitcode:CPF-Ionic/capacitor-local-notifications"},"bugs":{"url":"https://gitcode.com/CPF-Ionic/capacitor-local-notifications/issues"},"keywords":["capacitor","plugin","native"],"author":{"name":"Huawei Device Co., Ltd and iSoftStone Information Technology","url":"Group"},"license":"MIT","_id":"@capacitor-ohos/local-notifications@8.0.1","gitHead":"421849c3bf710118595b4cca91d47f431291162c","_nodeVersion":"22.0.0","_npmVersion":"10.5.1","dist":{"integrity":"sha512-RT8YKPM5gDes++UZQgAg1z0TynWUdNT62vD4SyOfzNzvGv7MksibtkdFp49HtpqRE3Di6Mly3JO5pYC1GJeBKQ==","shasum":"4483700c8f65ba679524a852f8c6ab5674e946b5","tarball":"https://registry.npmjs.org/@capacitor-ohos/local-notifications/-/local-notifications-8.0.1.tgz","fileCount":13,"unpackedSize":123140,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHrBiS17Av+r4VltDXhDGfq40z73gmXiykJwP0UYAfJUAiEAqm9GpUK+YNoNLLNHAJyZjcTu6L0sYSrXkClQIpqJ2oA="}]},"_npmUser":{"name":"luqi_tan","email":"295099422@qq.com"},"directories":{},"maintainers":[{"name":"luqi_tan","email":"295099422@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/local-notifications_8.0.1_1784796608655_0.6106604406599114"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-30T10:57:07.811Z","modified":"2026-07-23T08:50:09.135Z","8.0.0":"2026-04-30T10:57:08.114Z","8.0.1":"2026-07-23T08:50:08.963Z"},"bugs":{"url":"https://gitcode.com/CPF-Ionic/capacitor-local-notifications/issues"},"author":{"name":"Huawei Device Co., Ltd and iSoftStone Information Technology","url":"Group"},"license":"MIT","keywords":["capacitor","plugin","native"],"repository":{"type":"git","url":"gitcode:CPF-Ionic/capacitor-local-notifications"},"description":"The Local Notifications API provides a way to schedule device notifications locally (i.e. without a server sending push notifications).","maintainers":[{"name":"luqi_tan","email":"295099422@qq.com"}],"readme":"# <center>`@capacitor/local-notifications`</center>\r\n[![zh-CN](https://img.shields.io/badge/lang-中文-blue.svg)](README.md)\r\n[![en](https://img.shields.io/badge/lang-English-blue.svg)](README.en.md)\r\n\r\n本项目基于 [@capacitor/local-notifications@8.0.0](https://www.npmjs.com/package/@capacitor/local-notifications) 开发。\r\n\r\n## 简介\r\n\r\n本地通知 API 提供了一种在本地安排设备通知的方式。本插件是 capacitor 生态系统中的核心插件，为跨平台应用开发提供设备差异化适配能力，兼容 capacitor 的 Android、iOS 等主流移动平台及浏览器环境中使用，本文档仅说明在 OpenHarmony 系统中的使用情况。\r\n\r\n定时通知中，普通应用如果没有代理提醒的权限，提醒数量为 0，单个普通应用提醒数量不超过 30 个。\r\n\r\n## 支持平台\r\n\r\n- **OpenHarmony**：5.0+\r\n\r\n## 下载安装\r\n\r\n通过命令行或手动引入即可快速安装插件，支持从npm仓库获取。\r\n\r\n### 命令行安装（推荐）\r\n\r\n安装hionic CLI：\r\n\r\n```bash\r\nnpm install -g hionic\r\n```\r\n\r\n以下两种方式中**任选其一**即可，无需重复操作：\r\n\r\nnpm安装：\r\n\r\n```bash\r\n# 安装插件\r\nnpm install @capacitor/local-notifications\r\n\r\n# 同步插件\r\nhionic sync openharmony\r\n```\r\n\r\nhionic CLI安装：\r\n\r\n```bash\r\nhionic plugin add @capacitor/local-notifications\r\n```\r\n\r\n### 手动引入安装\r\n\r\n根据插件源码中 `plugin.xml` 配置在项目中引入插件：\r\n\r\n#### 1. 添加插件配置\r\n\r\n根据 `plugin.xml` 的 `config-json` 项，找到 `entry` 模块中 `capacitor.plugins.json` 文件，并根据 `param` 标签添加配置如下：\r\n\r\n```json\r\n[\r\n  {\r\n    \"pkg\": \"@capacitor/local-notifications\",\r\n    \"classpath\": \"LocalNotifications\"\r\n  }\r\n]\r\n```\r\n\r\n#### 2. 修改 CMake 配置\r\n\r\n根据 `plugin.xml` 的 `CMakeLists` 项，找到 `capacitor` 模块，路径为 `target` 字段的 `CMakeLists.txt` 文件，并添加 `add_subdirectory` 和 `target_link_libraries` 如下：\r\n\r\n```cmake\r\n// ...\r\nadd_subdirectory(LocalNotifications)\r\n// ...\r\n\r\n// ...\r\ntarget_link_libraries(capacitor PUBLIC\r\n  \"-Wl,--whole-archive\"\r\n  // ...\r\n  LocalNotifications\r\n  // ...\r\n  \"-Wl,--no-whole-archive\"\r\n// ...\r\n)\r\n```\r\n\r\n#### 3. 复制源码文件\r\n\r\n根据 `plugin.xml` 的 `source-file` 项，根据 `src` 字段找到需要复制的文件，并复制到对应的目录：\r\n\r\n将源码中 src/main/cpp/LocalNotifications 目录下的 LocalNotifications.h、LocalNotifications.cpp、CMakeLists.txt 文件引入到 capacitor 模块中 src/main/cpp/LocalNotifications 目录下。\r\n\r\n将源码中 src/main/ets/components/LocalNotifications 目录下的 LocalNotifications.ets、LocalNotificationModel.ets、NotificationStorage.ets、NotificationAction.ets 文件引入到 capacitor 模块中 src/main/ets/components/LocalNotifications 目录下。\r\n\r\n在 `capacitor` 模块的 `build-profile.json5` 文件中，`buildOption/arkOptions/runtimeOnly/sources` 配置项数组中加入拷贝的 ets 文件路径：\r\n\r\n```json\r\n\"buildOption\": {\r\n  // ...\r\n  \"arkOptions\": {\r\n    \"runtimeOnly\": [\r\n      // ...\r\n      \"./src/main/ets/components/LocalNotifications/LocalNotifications.ets\"\r\n      // ...\r\n    ]\r\n  }\r\n}\r\n```\r\n\r\n## 卸载\r\n\r\n```bash\r\n# 卸载 local-notifications 插件\r\nhionic plugin remove @capacitor/local-notifications\r\n```\r\n\r\n## 约束与限制\r\n\r\n### 兼容性\r\n\r\n在以下版本中已测试通过：\r\n\r\n1. SDK: 5.0.5(17); IDE: DevEco Studio: 6.0.0; ROM: 5.1.0.150;\r\n\r\n### 权限要求\r\n\r\n不需要额外权限。\r\n\r\n## 配置\r\n\r\n以下配置可用：\r\n\r\n| 数据          | 类型      | 描述           |\r\n| ------------- | --------- | -------------- |\r\n| channelId | Channel | 决定通知的展示通道 |\r\n\r\n### 示例\r\n\r\n#### capacitor.config.json\r\n\r\n位置：`capacitor.config.json`\r\n\r\n```json\r\n{\r\n  \"plugins\": {\r\n    \"localNotifications\": {\r\n      \"channelId\": 1\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## 使用示例\r\n\r\n### 基础示例 1：安排一个或多个本地通知\r\n\r\n```typescript\r\nimport { LocalNotifications } from '@capacitor/local-notifications';\r\n\r\nconst handleSchedule = async (params = notificationParams.value.schedule) => {\r\n  try {\r\n    const notifId = params.id || Math.floor(Date.now() / 1000);\r\n\r\n    // 自动将生成的 ID 赋值给取消和移除操作的参数\r\n    notificationParams.value.cancel.id = notifId;\r\n    notificationParams.value.removeDelivered.id = notifId;\r\n\r\n    // 处理调度时间\r\n    let schedule = params.schedule;\r\n    const scheduleAt = (params as any).scheduleAt;\r\n    if (scheduleAt) {\r\n      schedule = {\r\n        at: new Date(scheduleAt)\r\n      };\r\n    }\r\n\r\n    await LocalNotifications.schedule({\r\n      notifications: [\r\n        {\r\n          title: params.title,\r\n          body: params.body,\r\n          largeBody: params.largeBody,\r\n          id: notifId,\r\n          smallIcon: params.smallIcon,\r\n          largeIcon: params.largeIcon,\r\n          extra: params.extra ? JSON.parse(params.extra) : undefined,\r\n          channelId: params.channelId,\r\n          ongoing: params.ongoing,\r\n          autoCancel: params.autoCancel,\r\n          inboxList: params.inboxList ? params.inboxList.split(',') : undefined,\r\n          schedule: schedule\r\n        }\r\n      ]\r\n    });\r\n    apiButtonSectionRef.value?.updateButtonResult('schedule', {\r\n      status: 'success',\r\n      data: {\r\n        rawResponse: {}\r\n      },\r\n      message: `将在 ${schedule.at ? new Date(schedule.at).toLocaleString() : '指定时间'} 发送通知，ID: ${notifId}`\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('schedule', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `安排通知失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n### 基础示例 2：获取待处理的通知\r\n\r\n```typescript\r\nconst handleGetPending = async () => {\r\n  try {\r\n    const pending = await LocalNotifications.getPending();\r\n    apiButtonSectionRef.value?.updateButtonResult('get-pending', {\r\n      status: 'success',\r\n      data: {\r\n        result: pending,\r\n        rawResponse: pending\r\n      },\r\n      message: `待处理通知数量: ${pending.notifications.length}`\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('get-pending', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `获取待处理通知失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n### 基础示例 3：注册通知显示时要执行的操作\r\n\r\n```typescript\r\nconst handleRegisterActionTypes = async (params = notificationParams.value.registerActionTypes) => {\r\n  try {\r\n    // 处理 actions 参数，将 JSON 字符串转换为对象\r\n    let actions: any = params.actions;\r\n    if (typeof actions === 'string') {\r\n      actions = JSON.parse(actions);\r\n    }\r\n\r\n    await LocalNotifications.registerActionTypes({\r\n      types: [\r\n        {\r\n          id: params.typeId,\r\n          actions: actions\r\n        }\r\n      ]\r\n    });\r\n\r\n    apiButtonSectionRef.value?.updateButtonResult('register-action-types', {\r\n      status: 'success',\r\n      data: {\r\n        rawResponse: {}\r\n      },\r\n      message: '操作类型已注册'\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('register-action-types', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `注册操作类型失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n### 基础示例 4：取消某个定时提醒\r\n\r\n```typescript\r\nconst handleCancel = async (params = notificationParams.value.cancel) => {\r\n  try {\r\n    await LocalNotifications.cancel({\r\n      notifications: [{ id: params.id }]\r\n    });\r\n    apiButtonSectionRef.value?.updateButtonResult('cancel', {\r\n      status: 'success',\r\n      data: {\r\n        rawResponse: {}\r\n      },\r\n      message: `已取消通知，ID: ${params.id}`\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('cancel', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `取消通知失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n### 基础示例 5：检查本地通知是否可用\r\n\r\n```typescript\r\nconst handleAreEnabled = async () => {\r\n  try {\r\n    const result = await LocalNotifications.areEnabled();\r\n    apiButtonSectionRef.value?.updateButtonResult('are-enabled', {\r\n      status: 'success',\r\n      data: {\r\n        result,\r\n        rawResponse: result\r\n      },\r\n      message: `通知是否启用: ${result.value ? '是' : '否'}`\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('are-enabled', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `检查通知状态失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n### 基础示例 6：检查本地通知权限是否已授予\r\n\r\n```typescript\r\nconst handleCheckPermissions = async () => {\r\n  try {\r\n    const result = await LocalNotifications.checkPermissions();\r\n    apiButtonSectionRef.value?.updateButtonResult('check-permissions', {\r\n      status: 'success',\r\n      data: {\r\n        result,\r\n        rawResponse: result\r\n      },\r\n      message: `通知权限: ${result.display}`\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('check-permissions', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `检查权限失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n### 基础示例 7：本地通知请求权限\r\n\r\n```typescript\r\nconst handleRequestPermissions = async () => {\r\n  try {\r\n    const result = await LocalNotifications.requestPermissions();\r\n    apiButtonSectionRef.value?.updateButtonResult('request-permissions', {\r\n      status: 'success',\r\n      data: {\r\n        result,\r\n        rawResponse: result\r\n      },\r\n      message: `请求权限结果: ${result.display}`\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('request-permissions', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `请求权限失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n### 基础示例 8：删除所有状态栏上的通知\r\n\r\n```typescript\r\nconst handleRemoveAllDeliveredNotifications = async () => {\r\n  try {\r\n    await LocalNotifications.removeAllDeliveredNotifications();\r\n    apiButtonSectionRef.value?.updateButtonResult('remove-all-delivered', {\r\n      status: 'success',\r\n      message: '已移除所有已送达的通知'\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('remove-all-delivered', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `移除已送达通知失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n### 基础示例 9：删除状态栏上的某个通知\r\n\r\n```typescript\r\nconst handleRemoveDeliveredNotifications = async (params = notificationParams.value.removeDelivered) => {\r\n  try {\r\n    await LocalNotifications.removeDeliveredNotifications({\r\n      notifications: [{ \r\n        id: params.id,\r\n        title: params.title || 'Notification',\r\n        body: params.body || 'Notification body'\r\n      }]\r\n    });\r\n    apiButtonSectionRef.value?.updateButtonResult('remove-delivered', {\r\n      status: 'success',\r\n      data: {\r\n        rawResponse: {}\r\n      },\r\n      message: `已移除通知，ID: ${params.id}`\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('remove-delivered', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `移除已送达通知失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n### 基础示例 10：获取状态栏上的全部通知\r\n\r\n```typescript\r\nconst handleGetDeliveredNotifications = async () => {\r\n  try {\r\n    const result = await LocalNotifications.getDeliveredNotifications();\r\n    apiButtonSectionRef.value?.updateButtonResult('get-delivered', {\r\n      status: 'success',\r\n      data: {\r\n        result,\r\n        rawResponse: result\r\n      },\r\n      message: `已送达通知数量: ${result.notifications.length}`\r\n    });\r\n  } catch (error) {\r\n    apiButtonSectionRef.value?.updateButtonResult('get-delivered', {\r\n      status: 'error',\r\n      data: {\r\n        rawResponse: error\r\n      },\r\n      message: `获取已送达通知失败: ${error instanceof Error ? error.message : String(error)}`\r\n    });\r\n  }\r\n};\r\n```\r\n\r\n## 使用说明\r\n\r\n### 接口方法\r\n\r\n| 方法名                                                               | 返回类型                                | 描述                     |\r\n| ------------------------------------------------------------------- | --------------------------------------- | ------------------------ |\r\n| schedule(options: [ScheduleOptions](#scheduleoptions) \\| Promise&lt;[ScheduleResult](#scheduleresult)&gt;) | 安排一个或多个本地通知。    ||\r\n| getPending()                                                    | Promise&lt;[PendingResult](#pendingresult)&gt; | 获取待触发的通知。       |\r\n| registerActionTypes(options: [RegisterActionTypesOptions](#RegisterActionTypesOptions)) | Promise<void> | 注册在显示通知时要采取的操作。 |\r\n| cancel(options: [CancelOptions](#CancelOptions]))                                 | Promise<void> | 取消待处理通知。        |\r\n| areEnabled()                                                    | Promise&lt;[EnabledResult](#enabledresult)&gt; | 检查通知是否已启用。      |\r\n| getDeliveredNotifications()                                     | Promise&lt;[DeliveredNotifications](#deliverednotifications)&gt; | 获取通知屏幕上可见的通知列表。 |\r\n| removeDeliveredNotifications(delivered: [DeliveredNotifications](#deliverednotifications])) | Promise<void> | 从通知屏幕上移除指定的通知。  |\r\n| removeAllDeliveredNotifications()                               | Promise<void> | 从通知屏幕移除所有通知。    |\r\n| createChannel(channel: [Channel](#channel]))                                | Promise<void> | 暂不支持。           |\r\n| deleteChannel(args: { id: string; })                            | Promise<void> | 暂不支持。           |\r\n| listChannels()                                                  | Promise&lt;[ListChannelsResult](#listchannelsresult)&gt; | 暂不支持。           |\r\n| checkPermissions()                                              | Promise&lt;[PermissionStatus](#permissionstatus)&gt; | 检查显示本地通知的权限。    |\r\n| requestPermissions()                                            | Promise&lt;[PermissionStatus](#permissionstatus)&gt; | 请求显示本地通知的权限。    |\r\n| changeExactNotificationSetting()                                | Promise&lt;[SettingsPermissionStatus](#settingspermissionstatus)&gt; | 暂不支持。           |\r\n| checkExactNotificationSetting()                                 | Promise&lt;[SettingsPermissionStatus](#settingspermissionstatus)&gt; | 暂不支持。           |\r\n| addListener('localNotificationReceived', ...)                   | Promise&lt;[PluginListenerHandle](#pluginlistenerhandle)&gt; | 暂不支持。           |\r\n| addListener('localNotificationActionPerformed', ...)            | Promise&lt;[PluginListenerHandle](#pluginlistenerhandle)&gt; | 暂不支持。           |\r\n| removeAllListeners()                                            | Promise<void> | 暂不支持。           |\r\n\r\n### 数据结构\r\n\r\n#### ScheduleResult\r\n\r\n| Prop                | Type                            | Description |\r\n| ------------------- | ------------------------------- | ----------- |\r\n| **`notifications`** | [LocalNotificationDescriptor](#LocalNotificationDescriptor)[] | 预定通知列表。     |\r\n\r\n#### RegisterActionTypesOptions\r\n\r\n| Prop                | Type                            | Description |\r\n| ------------------- | ------------------------------- | ----------- |\r\n| types | [ActionType](#ActionType)[] | 需要注册的动作类型列表     |\r\n\r\n#### ActionType\r\n\r\n| Prop                | Type                            | Description |\r\n| ------------------- | ------------------------------- | ----------- |\r\n| **`id`** | `string` | 动作类型唯一标识，推送通知中通过 actionTypeId 引用   |\r\n| **`actions`** | [Action](#Action)[] | 绑定至该动作类型的所有操作列表  |\r\n| **`iosHiddenPreviewsBodyPlaceholder`** | `string` | 设置通知分类静默预览占位文案，仅 iOS 生效  |\r\n| **`iosCustomDismissAction`** | `boolean` | 设置通知分类静默预览占位文案，仅 iOS 生效  |\r\n| **`iosAllowInCarPlay`** | `boolean` | 允许在车载系统中展示该通知，仅 iOS 生效   |\r\n| **`iosHiddenPreviewsShowTitle`** | `boolean` | 静默预览时是否显示通知标题，仅 iOS 生效  |\r\n| **`iosHiddenPreviewsShowSubtitle`** | `boolean` | 静默预览时是否显示通知副标题，仅 iOS 生效  |\r\n\r\n#### Action\r\n\r\n| Prop                | Type                            | Description |\r\n| ------------------- | ------------------------------- | ----------- |\r\n| **`id`** | `string` | 操作唯一标识，点击事件中以 actionId 获取   |\r\n| **`title`** | `string` | 操作按钮展示文字 |\r\n| **`requiresAuthentication`** | `boolean` | 点击该操作是否需要解锁验证，仅 iOS 生效  |\r\n| **`foreground`** | `boolean` | 点击后是否拉起应用至前台，仅 iOS 生效 |\r\n| **`destructive`** | `boolean` | 是否标记为危险操作（红色样式），仅 iOS 生效   |\r\n| **`input`** | `boolean` | 是否启用通知内文字输入框，仅 iOS 生效 |\r\n| **`inputButtonTitle`** | `string` | 输入框确认按钮文字，仅开启 input 后 iOS 可用  |\r\n| **`inputPlaceholder`** | `string` | 输入框占位提示文字，仅开启 input 后 iOS 可用  |\r\n\r\n#### CancelOptions\r\n\r\n| Prop                | Type                            | Description |\r\n| ------------------- | ------------------------------- | ----------- |\r\n| **`notifications`** | [LocalNotificationDescriptor](#LocalNotificationDescriptor)[] | 待取消的本地通知集合   |\r\n\r\n#### EnabledResult\r\n\r\n| Prop                | Type                            | Description |\r\n| ------------------- | ------------------------------- | ----------- |\r\n| **`value`** | `boolean` |设备是否已开启本地通知权限  |\r\n\r\n#### DeliveredNotifications\r\n\r\n| Prop                | Type                            | Description |\r\n| ------------------- | ------------------------------- | ----------- |\r\n| **`notifications`** | [DeliveredNotificationSchema](#DeliveredNotificationSchema)[] | 通知栏当前可见的所有通知列表  |\r\n\r\n#### DeliveredNotificationSchema\r\n\r\n| Prop                | Type                            | Description |\r\n| ------------------- | ------------------------------- | ----------- |\r\n| **`id`** | `number` | T通知唯一编号  |\r\n| **`tag`** | `string` | 通知标签标识，仅安卓生效 |\r\n| **`title`** | `string` | 通知标题  |\r\n| **`body`** | `string` | 通知正文内容 |\r\n| **`group`** | `string` | 通知所属分组，仅安卓生效  |\r\n| **`groupSummary`** | `boolean` | 是否为分组汇总通知，仅安卓生效 |\r\n| **`data`** | `any` | 通知携带附加业务数据，仅安卓生效 |\r\n| **`extra`** | `any` | 通知额外扩展数据，仅 iOS 生效  |\r\n| **`attachments`** | [Attachment](#Attachment)[] | 通知附带媒体附件，仅 iOS 生效  |\r\n| **`actionTypeId`** | `string` |绑定的通知动作类型 ID，仅 iOS 生效  |\r\n| **`schedule`** | [Schedule](#Schedule) | 通知触发定时规则，仅 iOS 生效  |\r\n| **`sound`** | `any` | 通知提示音配置，仅 iOS 生效 |\r\n\r\n\r\n#### LocalNotificationDescriptor\r\n\r\n描述本地通知的对象。\r\n\r\n| Prop     | Type     | Description |\r\n| -------- | -------- | ----------- |\r\n| **`id`** | `number` | 通知标识符。      |\r\n\r\n#### ScheduleOptions\r\n\r\n| Prop                | Type                        | Description |\r\n|---------------------|-----------------------------|-------------|\r\n| **`notifications`** | `LocalNotificationSchema[]` | 要安排的通知列表。   |\r\n\r\n#### LocalNotificationSchema\r\n\r\n| Prop                   | Type           | Description                                                                                      |\r\n|------------------------|----------------|--------------------------------------------------------------------------------------------------|\r\n| **`title`**            | `string`       | 通知的标题。                                                                                           |\r\n| **`body`**             | `string`       | 通知正文，显示在标题下方，普通文本内容。                                                                             |\r\n| **`largeBody`**        | `string`       | 通知正文，显示在标题下方，长文本内容。                                                                              |\r\n| **`summaryText`**      | `string`       | 暂不支持。                                                                                            |\r\n| **`id`**               | `string`       | 通知标识符。(仅存在即刻通知中,在定时通知中，schedule返回的id是取用取消待触发的通知)                                                 |\r\n| **`schedule`**         | `Schedule`     | 稍后安排此通知。                                                                                         |\r\n| **`sound`**            | `string`       | 通知的响铃声，资源需放在resources/rawfile目录下(仅在即刻通知中生效)。                                                     |\r\n| **`smallIcon`**        | `string`       | 通知状态栏上的图标，资源需放在resources/base/media目录下(仅在即刻通知中生效,且API小于20)。                                      |\r\n| **`largeIcon`**        | `string`       | 通知框中的一个大图标，图标应放置于应用的resources/base/media文件夹内(仅在即刻通知中生效) 。                                        | \r\n| **`iconColor`**        | `string`       | 暂不支持。                                                                                            |\r\n| **`attachments`**      | `Attachment[]` | 暂不支持。                                                                                            |\r\n| **`actionTypeId`**     | `string`       | 将此通知与一种操作类型相关联。                                                                                  |\r\n| **`extra`**            | `any`          | 设置额外数据以存储在此通知中(仅在即刻通知中生效) 。                                                                      |\r\n| **`threadIdentifier`** | `string`       | 暂不支持。                                                                                            |\r\n| **`summaryArgument`**  | `string`       | 暂不支持。                                                                                            |\r\n| **`group`**            | `string`       | 即刻通知中支持。                                                                                         |\r\n| **`groupSummary`**     | `string`       | 暂不支持。                                                                                            |\r\n| **`channelId`**        | `Channel`      | 通知槽类型。默认值为OTHER_TYPES。(仅在即刻通知中生效，且需要在capacitor.config文件中配置)                                      |\r\n| **`ongoing`**          | `boolean`      | 预留功能，暂不支持。                                                                                       |\r\n| **`autoCancel`**       | `boolean`      | 通知是否自动清除。此参数仅在通知携带wantAgent或actionButtons时有效。 true（默认）：点击通知或按钮后，当前通知自动清除。 false：点击通知或按钮后，当前通知保留。 |\r\n| **`inboxList`**        | `string[]`     | 通知正文，显示在标题下方。最多可显示三行内容，每行内容超长后以“...”截断。用在contentType是NOTIFICATION_CONTENT_MULTILINE的情况下是必填项      |\r\n| **`silent`**           | `string`       | 暂不支持。                                                                                            |\r\n\r\n#### Schedule\r\n代表一个通知的时间表，使用“at”、“on”或“every”来安排通知。\r\n\r\n| Prop                 | Type            | Description                                                      |\r\n|----------------------|-----------------|------------------------------------------------------------------|\r\n| **`at`**             | `Date`          | 在特定日期和时间安排通知。格式如:2026-02-11T16:22:15,如果时间早于当前时间则立刻发送，定时最少延迟1分钟之后 |\r\n| **`repeats`**        | `boolean`       | 暂不支持。                                                            |\r\n| **`allowWhileIdle`** | `boolean`       | 暂不支持。                                                            |\r\n| **`on`**             | `ScheduleOn`    | 暂不支持。                                                            |\r\n| **`every`**          | `ScheduleEvery` | 暂不支持。                                                            |\r\n| **`count`**          | `number`        | 暂不支持。                                                            |\r\n\r\n#### Date\r\n启用日期和时间的基本存储和检索。\r\n\r\n| Prop                     | Type           | Description                                            |\r\n|--------------------------|----------------|--------------------------------------------------------|\r\n| **`toString`**           | `() => string` | 返回日期的字符串表示形式。字符串的格式取决于区域设置。                            |\r\n| **`toDateString`**       | `() => string` | 将日期作为字符串值返回。                                           |\r\n| **`toTimeString`**       | `() => string` | 返回一个作为字符串值的时间。                                         |\r\n| **`toLocaleString`**     | `() => string` | 返回一个适合主机环境当前区域设置的字符串值。                                 |\r\n| **`toLocaleDateString`** | `() => string` | 返回一个适合主机环境当前区域设置的字符串形式的日期。                             |\r\n| **`toLocaleTimeString`** | `() => string` | 返回一个适合主机环境当前区域设置的时间字符串值。                               |\r\n| **`valueOf`**            | `() => string` | 返回自1970年1月1日午夜（UTC）以来以毫秒为单位存储的时间值。                     |\r\n| **`getTime`**            | `() => string` | 获取以毫秒为单位的时间值。                                          |\r\n| **`getFullYear`**        | `() => string` | 获取年份，使用本地时间。                                           |\r\n| **`getUTCFullYear`**     | `() => string` | 使用协调世界时(UTC)获取年份。                                      |\r\n| **`getMonth`**           | `() => string` | 获取月份，使用本地时间。                                           |\r\n| **`getUTCMonth`**        | `() => string` | 使用协调世界时(UTC)获取Date对象的月份。                               |\r\n| **`getDate`**            | `() => string` | 获取当月的第几天，使用本地时间。                                       |\r\n| **`getUTCDate`**         | `() => string` | 获取当月的第几天，使用协调世界时（UTC）。                                 |\r\n| **`getDay`**             | `() => string` | 获取星期几，使用本地时间。                                          |\r\n| **`getUTCDay`**          | `() => string` | 使用协调世界时(UTC)获取星期几。                                     |\r\n| **`getHours`**           | `() => string` | 获取日期中的小时数，使用本地时间。                                      |\r\n| **`getUTCHours`**        | `() => string` | 使用协调世界时(UTC)获取Date对象中的小时值。                             |\r\n| **`getMinutes`**         | `() => string` | 获取Date对象的分钟数，使用本地时间。                                   |\r\n| **`getUTCMinutes`**      | `() => string` | 使用协调世界时(UTC)获取日期对象的分钟数。                                |\r\n| **`getSeconds`**         | `() => string` | 获取Date对象的秒数，使用本地时间。                                    |\r\n| **`getUTCSeconds`**      | `() => string` | 使用协调世界时(UTC)获取日期对象的秒数。                                 |\r\n| **`getMilliseconds`**    | `() => string` | 使用本地时间获取日期的毫秒数。                                        |\r\n| **`getUTCMilliseconds`** | `() => string` | 使用协调世界时(UTC)获取Date对象的毫秒数。                              |\r\n| **`getTimezoneOffset`**  | `() => string` | 获取本地计算机时间与协调世界时（UTC）之间的分钟差。                            |\r\n| **`setTime`**            | `() => string` | 设置Date对象中的日期和时间值。                                      |\r\n| **`setMilliseconds`**    | `() => string` | 使用本地时间设置Date对象中的毫秒值。                                   |\r\n| **`setUTCMilliseconds`** | `() => string` | 使用世界协调时间(UTC)设置Date对象中的毫秒值。                            |\r\n| **`setSeconds`**         | `() => string` | 使用本地时间设置Date对象中的秒数值。                                   |\r\n| **`setUTCSeconds`**      | `() => string` | 使用世界协调时间(UTC)设置Date对象中的秒数值。                            |\r\n| **`setMinutes`**         | `() => string` | 使用本地时间设置Date对象中的分钟值。                                   |\r\n| **`setUTCMinutes`**      | `() => string` | 使用世界协调时间(UTC)设置Date对象中的分钟值。                            |\r\n| **`setHours`**           | `() => string` | 使用本地时间设置Date对象中的小时值。                                   |\r\n| **`setUTCHours`**        | `() => string` | 使用协调世界时(UTC)设置Date对象中的小时值。                             |\r\n| **`setDate`**            | `() => string` | 使用本地时间设置日期对象的月份中的数字日值。                                 |\r\n| **`setUTCDate`**         | `() => string` | 使用世界协调时间（UTC）在Date对象中设置月份的数字日期。                        |\r\n| **`setMonth`**           | `() => string` | 使用本地时间设置Date对象中的月份值。                                   |\r\n| **`setUTCMonth`**        | `() => string` | 使用世界协调时间(UTC)设置Date对象中的月份值。                            |\r\n| **`setFullYear`**        | `() => string` | 使用本地时间设置Date对象的年份。                                     |\r\n| **`setUTCFullYear`**     | `() => string` | 使用世界协调时间（UTC）设置Date对象中的年份值。                            |\r\n| **`toUTCString`**        | `() => string` | 返回一个使用协调世界时(UTC)转换为字符串的日期。                             |\r\n| **`toISOString`**        | `() => string` | 返回一个以ISO格式表示的日期字符串值。                                   |\r\n| **`toJSON`**             | `() => string` | JSON.stringify方法用于将对象的数据转换为JavaScript对象表示法（JSON）序列化格式。 |\r\n\r\n#### ScheduleOn(暂不支持)\r\n\r\n| Prop          | Type      |\r\n|---------------|-----------| \r\n| **`year`**    | `number`  | \r\n| **`month`**   | `number`  | \r\n| **`day`**     | `number`  | \r\n| **`weekday`** | `Weekday` | \r\n| **`hour`**    | `number`  | \r\n| **`minute`**  | `number`  | \r\n| **`second`**  | `number`  | \r\n\r\n\r\n#### Attachment(暂不支持)\r\n\r\n| Prop          | Type     | Description                                                 |\r\n|---------------|----------|-------------------------------------------------------------|\r\n| **`id`**      | `string` | 附件标识符。                                                      |\r\n| **`url`**     | `string` | 附件的URL。使用res方案引用网络资源，例如res:///assets/img/icon.png。也接受文件URL。 |\r\n| **`options`** | `string` | 附件选项。                                                       |\r\n\r\n#### AttachmentOptions(暂不支持)\r\n\r\n| Prop                                                             | Type     | Description |\r\n|------------------------------------------------------------------|----------|-------------|\r\n| **`iosUNNotificationAttachmentOptionsTypeHintKey`**              | `string` | 不支持。        |\r\n| **`iosUNNotificationAttachmentOptionsThumbnailHiddenKey`**       | `string` | 不支持。        |\r\n| **`iosUNNotificationAttachmentOptionsThumbnailClippingRectKey`** | `string` | 不支持。        |\r\n| **`iosUNNotificationAttachmentOptionsThumbnailTimeKey`**         | `string` | 不支持。        |\r\n\r\n#### PendingResult\r\n\r\n| Prop                | Type                               | Description |\r\n|---------------------|------------------------------------|-------------|\r\n| **`notifications`** | `PendingLocalNotificationSchema[]` | 待处理通知列表     |\r\n\r\n#### PendingLocalNotificationSchema\r\n\r\n| Prop           | Type       | Description     |\r\n|----------------|------------|-----------------|\r\n| **`title`**    | `string`   | 通知的标题。          |\r\n| **`body`**     | `string`   | 通知正文，显示在标题下方。   |\r\n| **`id`**       | `number`   | 通知标识符。          |\r\n| **`schedule`** | `schedule` | 稍后安排此通知。。       |\r\n| **`extra`**    | `any`      | 设置额外数据以存储在此通知中。 |\r\n\r\n#### Channel\r\n\r\n| 支柱              | 类型         | 描述                                                         | 默认 | 自从  |\r\n| ----------------- | ------------ | ------------------------------------------------------------ | ---- | ----- |\r\n| **`id`**          | `string`     | 频道标识符。                                                 |      | 1.0.0 |\r\n| **`name`**        | `string`     | 该频道的易读名称（向用户显示）。                             |      | 1.0.0 |\r\n| **`description`** | `string`     | 本频道的描述（向用户显示）。                                 |      | 1.0.0 |\r\n| **`sound`**       | `string`     | 此频道发布的通知应播放声音。重要性至少为 1 的通知频道`3`应有声音。声音文件的文件名应相对于 Android 应用目录指定`res/raw`。如果未提供声音文件或找不到声音文件，则不会播放声音。 |      | 1.0.0 |\r\n| **`importance`**  | `Importance` | 此频道发布的通知的中断级别。                                 | `3`  | 1.0.0 |\r\n| **`visibility`**  | `Visibility` | 此设置控制发布到此频道的通知是否显示在锁屏界面，以及如果显示，是否以隐藏信息的形式显示。 |      | 1.0.0 |\r\n| **`lights`**      | `boolean`    | 是否在支持此功能的设备上显示发布到此频道的通知指示灯。       |      | 1.0.0 |\r\n| **`lightColor`**  | `string`     | 此频道发布的通知的灯光颜色。仅当此频道启用灯光功能且设备支持时才可用。支持的颜色格式为`#RRGGBB`和`#RRGGBBAA`。 |      | 1.0.0 |\r\n| **`vibration`**   | `boolean`    | 是否应使发布到此频道的通知振动。                             |      | 1.0.0 |\r\n\r\n#### ListChannelsResult\r\n\r\n| 支柱           | 类型        | 描述           | 自从  |\r\n| -------------- | ----------- | -------------- | ----- |\r\n| **`channels`** | `Channel[]` | 通知渠道列表。 | 1.0.0 |\r\n\r\n#### PermissionStatus\r\n\r\n| 支柱          | 类型              | 描述                 | 自从  |\r\n| ------------- | ----------------- | -------------------- | ----- |\r\n| **`display`** | `PermissionState` | 显示通知的权限状态。 | 1.0.0 |\r\n\r\n#### SettingsPermissionStatus\r\n\r\n| 支柱              | 类型              | 描述                     | 自从  |\r\n| ----------------- | ----------------- | ------------------------ | ----- |\r\n| **`exact_alarm`** | `PermissionState` | 使用精确警报的权限状态。 | 6.0.0 |\r\n\r\n#### PluginListenerHandle\r\n\r\n| 支柱         | 类型                  |\r\n| ------------ | --------------------- |\r\n| **`remove`** | `() => Promise<void>` |\r\n\r\n#### ActionPerformed\r\n\r\n| 支柱               | 类型                      | 描述                                                         | 自从  |\r\n| ------------------ | ------------------------- | ------------------------------------------------------------ | ----- |\r\n| **`actionId`**     | `string`                  | 已执行操作的标识符。                                         | 1.0.0 |\r\n| **`inputValue`**   | `string`                  | 用户在通知中输入的值。仅适用于 iOS 上`input`设置为 的通知`true`。 | 1.0.0 |\r\n| **`notification`** | `LocalNotificationSchema` | 原始通知架构。                                               | 1.0.0 |\r\n\r\n### 类型别名\r\n\r\n#### ScheduleEvery\r\n\r\n```\r\n'year' | 'month' | 'two-weeks' | 'week' | 'day' | 'hour' | 'minute' | 'second'\r\n```\r\n\r\n#### Importance\r\n\r\n重要性级别。更多详情，请参阅[Android 开发者文档。](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)\r\n\r\n```\r\n1 | 2 | 3 | 4 | 5\r\n```\r\n\r\n#### Visibility\r\n\r\n通知可见性。更多详情，请参阅[Android 开发者文档。](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)\r\n\r\n```\r\n-1 | 0 | 1\r\n```\r\n\r\n#### PermissionState\r\n\r\n```\r\n'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'\r\n```\r\n\r\n### 枚举\r\n\r\n#### Weekday\r\n\r\n| 成员            | 价值 |\r\n| --------------- | ---- |\r\n| **`Sunday`**    | `1`  |\r\n| **`Monday`**    | `2`  |\r\n| **`Tuesday`**   | `3`  |\r\n| **`Wednesday`** | `4`  |\r\n| **`Thursday`**  | `5`  |\r\n| **`Friday`**    | `6`  |\r\n| **`Saturday`**  | `7`  |\r\n\r\n## 目录结构\r\n\r\n```\r\n|---- 项目根目录\r\n|     |---- src\r\n|           |---- main\r\n|                 |---- cpp\r\n|                       |---- LocalNotifications   # 插件核心 C++ 实现\r\n|                             |---- LocalNotifications.cpp\r\n|                             |---- LocalNotifications.h\r\n|                             |---- CMakeLists.txt\r\n|                 |---- ets  # 插件核心 ets 实现\r\n|                       |---- components\r\n|                               |---- LocalNotifications\r\n|                                     |---- LocalNotifications.ets\r\n|                                     |---- LocalNotificationModel.ets\r\n|                                     |---- NotificationStorage.ets\r\n|                                     |---- NotificationAction.ets\r\n|     |---- README.md          # 说明文档\r\n|     |---- package.json       # npm 配置文件\r\n|     |---- plugin.xml         # capacitor 插件配置\r\n|     |---- LICENSE            # 许可证文件\r\n```\r\n\r\n## 贡献代码\r\n\r\n使用过程中发现任何问题都可以提 [Issue](https://gitcode.com/CPF-Ionic/capacitor-local-notifications/issues)，当然，也非常欢迎发 [PR](https://gitcode.com/CPF-Ionic/capacitor-local-notifications/pulls) 共建。\r\n\r\n## 许可证\r\n\r\n本插件基于 **MIT License** 开源，详见 [LICENSE](./LICENSE) 文件。\r\n","readmeFilename":"README.md"}