From ca468936db8e1b4fea092d747becc9fb69ee4456 Mon Sep 17 00:00:00 2001 From: zhangzhenwei Date: Fri, 6 Feb 2026 17:11:04 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20[Issues:=20#IDP1YN]add=20react-native-p?= =?UTF-8?q?ush-notification=E6=8C=87=E5=AF=BC=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangzhenwei --- en/react-native-push-notification.md | 330 ++++++++++++++++++++++++ zh-cn/react-native-push-notification.md | 330 ++++++++++++++++++++++++ 2 files changed, 660 insertions(+) create mode 100644 en/react-native-push-notification.md create mode 100644 zh-cn/react-native-push-notification.md diff --git a/en/react-native-push-notification.md b/en/react-native-push-notification.md new file mode 100644 index 00000000..adba6919 --- /dev/null +++ b/en/react-native-push-notification.md @@ -0,0 +1,330 @@ +# React Native Push Notification + +A React Native push notification library designed for the OpenHarmonyOS platform, providing comprehensive notification management functionality. + +## Download and Usage + +### npm + +```bash +npm install @react-native-oh-tpl/react-native-push-notification +``` + +### yarn + +```bash +yarn add @react-native-oh-tpl/react-native-push-notification +``` + +The following code demonstrates the basic usage scenario of this library: + +When using it, the imported library name remains the same. + +```jsx +import PushNotification from '@react-native-oh-tpl/react-native-push-notification'; + + const sendBasicNotification = async () => { + try { + if (!PushNotification) { + showAlert('Error', 'PushNotification module unavailable'); + return; + } + const options = { + title: 'This is a regular message', + text: 'This is the content of the regular message', + id: Date.now(), + notificationType: NotificationType.TEXT, + isFloatingIcon: true, + sound: 'rawfile/sound.mp3', + notificationSlotType: SlotType.SOCIAL_COMMUNICATION, + }; + + const id = await PushNotification.localNotification(JSON.stringify(options)); + if (id !== undefined) { + console.info(`Basic notification sent with id: ${id}`); + showAlert('Success', `Notification sent, ID: ${id}`); + } else { + console.error('Send basic notification failed'); + showAlert('Failed', 'Sending notification failed'); + } + } catch (error) { + console.error('Send basic notification failed:', error); + showAlert('Exception', `Sending notification exception: ${error}`); + } + }; +``` + +#### ## Link + +| | Autolink Support | RN Framework Version | +| -------------------------- | ------------ | ------ | +| ~8.7.0 | No | 0.77 | +| ~8.6.4 | Yes | 0.72 | +| <= 8.6.3-0.4.17@deprecated | No | 0.72 | + +Projects using AutoLink need to be configured according to this document. Autolink framework guide: [https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/en/Autolinking.md](https://gitee.com/link?target=https%3A%2F%2Fgitcode.com%2Fopenharmony-sig%2Fohos_react_native%2Fblob%2Fmaster%2Fdocs%2Fen%2FAutolinking.md) +Projects using AutoLink need to be configured according to this document. Autolink framework guide: https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/en/Autolinking.md + +If your version supports Autolink and the project has already integrated Autolink, you can skip the ManualLink configuration. + +
+ ManualLink: This step is guidance for manually configuring native dependencies + +First, you need to open the HarmonyOS project `harmony` in DevEco Studio. + +### 1. Add overrides field to `oh-package.json5` in the project root directory + +```json +{ + ... + "overrides": { + "@rnoh/react-native-openharmony" : "./react_native_openharmony" + } +} +``` + +### 2. Introduce native code + +There are currently two methods: + +1. Import via har package (this method will be deprecated after IDE完善相关功能, currently preferred method); +2. Directly link source code. + +Method 1: Import via har package (recommended) + +> [!TIP] har packages are located in the `harmony` folder of the third-party library installation path. + +Open `entry/oh-package.json5`, add the following dependencies: + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-fast-image": "file:../../node_modules/@react-native-oh-tpl/react-native-push-notification/harmony/push_notification.har" + } +``` + +Click the `sync` button in the upper right corner + +Or execute in the terminal: + +```bash +cd entry +ohpm install +``` + +Method 2: Directly link source code + +To use direct source code linking, please refer to [Direct Source Code Linking Instructions](/en/link-source-code.md) + +### 3. Configure CMakeLists and introduce PushNotificationPackage + +> If using <= 8.6.3-0.4.17 version, please skip this chapter. + +Open `entry/src/main/cpp/CMakeLists.txt`, add: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-push-notification/src/main/cpp" ./fast-image) +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_push_notification) +# RNOH_END: manual_package_linking_2 +``` + +Open `entry/src/main/cpp/PackageProvider.cpp`, add: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "RTNPushNotificationPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx), + }; +} +``` + +### 4. Introduce PushNotificationPackage on the ArkTs side + +Open `entry/src/main/ets/RNPackagesFactory.ts`, add: + +```diff + ... ++ import {PushNotificationPackage} from '@react-native-oh-tpl/react-native-push-notification/ts'; + +export function createRNPackages(ctx: RNPackageContext): RNPackage[] { + return [ + new SamplePackage(ctx), ++ new FastImagePackage(ctx) + ]; +} +``` + +
+ +#### Run + +Click the `sync` button in the upper right corner + +Or execute in the terminal: + +```bash +cd entry + +ohpm install +``` + +Then compile and run. + +## Constraints and Limitations + +### Compatibility + +To use this library, you need to use the correct React-Native and RNOH versions. Additionally, you need to use compatible DevEco Studio and phone ROM. + +Validated on the following versions: + +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; + +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; + +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; + +## Properties + +### NotificationOptions + +| Name | Type | Description | Required | Platform | HarmonyOS Support | +|-------------------------|-----------|------------------------------------------------|----------|-------------|-------------------| +| id | string | Notification ID | no | iOS/Android | yes | +| showDeliveryTime | boolean | Whether to show delivery time | no | iOS/Android | yes | +| tapDismissed | boolean | Whether notification is automatically cleared | no | iOS/Android | yes | +| autoDeletedTime | number | Time for automatic clearing | no | iOS/Android | yes | +| wantAgent | object | WantAgent encapsulates the app's behavioral intentions, triggered when notification is clicked | no | iOS/Android | yes | +| extraInfo | object | Extended parameters | no | iOS/Android | yes | +| isAlertOnce | boolean | Set whether there is only one notification reminder | no | iOS/Android | yes | +| isStopwatch | boolean | Whether to show elapsed time | no | iOS/Android | yes | +| isCountDown | boolean | Whether to show countdown time | no | iOS/Android | yes | +| isFloatingIcon | boolean | Whether to show status bar icon | no | iOS/Android | yes | +| label | string | Notification label | no | iOS/Android | yes | +| smallIcon | string | Small icon (Base64 encoded or resource path) | no | iOS/Android | yes | +| largeIcon | string | Large icon (Base64 encoded or resource path) | no | iOS/Android | yes | +| lockscreenPicture | string | Picture displayed on lock screen | no | iOS/Android | yes | +| notificationType | string | Notification type (TEXT, LONGTEXT, LINES, PICTURE, PROGRESS) | no | iOS/Android | yes | +| title | string | Notification title | no | iOS/Android | yes | +| text | string | Notification content | no | iOS/Android | yes | +| additionalText | string | Notification additional content | no | iOS/Android | yes | +| briefText | string | Summary content of notification | no | iOS/Android | yes | +| longText | string | Long text of notification | no | iOS/Android | yes | +| expandedTitle | string | Title when notification expands | no | iOS/Android | yes | +| picture | string | Picture for picture notification (Base64 encoded or resource path) | no | iOS/Android | yes | +| fileName | string | Download file name (progress bar notification) | no | iOS/Android | yes | +| progressValue | number | Download progress (progress bar notification) | no | iOS/Android | yes | +| fireDate | Date | Scheduled notification trigger time | no | iOS/Android | yes | +| actionButtons | array | Array of notification buttons | no | iOS/Android | yes | +| groupName | string | Group notification name | no | iOS/Android | yes | +| notificationSlotType | string | Notification channel type | no | iOS/Android | yes | +| repeatType | string | Repeat type (minute, hour, day, week, month, time) | no | iOS/Android | yes | +| repeatTime | number | Repeat interval time | no | iOS/Android | yes | +| repeatInterval | number | Repeat interval (milliseconds) | no | iOS/Android | yes | +| repeatCount | number | Number of repeats (-1 means infinite repeat) | no | iOS/Android | yes | + +### NotificationType Enum + +| Name | Type | Description | Required | Platform | HarmonyOS Support | +|-----------|--------|--------------|----------|-------------|-------------------| +| TEXT | string | Basic text notification | no | iOS/Android | yes | +| LONGTEXT | string | Long text notification | no | iOS/Android | yes | +| LINES | string | Multi-line text notification | no | iOS/Android | yes | +| PICTURE | string | Picture notification | no | iOS/Android | yes | +| PROGRESS | string | Progress bar notification | no | iOS/Android | yes | + +### SlotType Enum + +| Name | Type | Description | Required | Platform | HarmonyOS Support | +|-----------------------|--------|--------------|----------|-------------|-------------------| +| UNKNOWN_TYPE | string | Unknown type | no | iOS/Android | yes | +| SOCIAL_COMMUNICATION | string | Social communication | no | iOS/Android | yes | +| SERVICE_INFORMATION | string | Service information | no | iOS/Android | yes | +| CONTENT_INFORMATION | string | Content information | no | iOS/Android | yes | +| LIVE_VIEW | string | Live viewing | no | iOS/Android | yes | +| CUSTOMER_SERVICE | string | Customer service | no | iOS/Android | yes | +| OTHER_TYPES | string | Other types | no | iOS/Android | yes | + +### SlotLevel Enum + +| Name | Type | Description | Required | Platform | HarmonyOS Support | +|---------------|--------|--------------|----------|-------------|-------------------| +| LEVEL_NONE | string | No level | no | iOS/Android | yes | +| LEVEL_MIN | string | Minimum level | no | iOS/Android | yes | +| LEVEL_LOW | string | Low level | no | iOS/Android | yes | +| LEVEL_DEFAULT | string | Default level | no | iOS/Android | yes | +| LEVEL_HIGH | string | High level | no | iOS/Android | yes | + +## Static Methods + +| Name | Description | Type | Required | Platform | HarmonyOS Support | +| --------------------------------------- | ----------------------- | -------- | -------- | ---------- | ----------------- | +| configure | Configure push notification service | function | no | iOS/Android | yes | +| localNotification | Send local notification | function | no | iOS/Android | yes | +| cancelLocalNotification | Cancel local notification with specified ID | function | no | iOS/Android | yes | +| cancelAllLocalNotifications | Cancel all local notifications | function | no | iOS/Android | yes | +| setApplicationIconBadgeNumber | Set application icon badge number | function | no | iOS/Android | yes | +| getApplicationIconBadgeNumber | Get application icon badge number | function | no | iOS/Android | yes | +| clearBadge | Clear badge | function | no | iOS/Android | yes | +| clearAllNotifications | Clear all notifications | function | no | iOS/Android | yes | +| removeAllDeliveredNotifications | Remove all delivered notifications | function | no | iOS/Android | yes | +| getDeliveredNotifications | Get list of delivered notifications | function | no | iOS/Android | yes | +| getScheduledLocalNotifications | Get scheduled local notifications | function | no | iOS/Android | yes | +| removeDeliveredNotifications | Remove delivered notification with specified ID | function | no | iOS/Android | yes | +| getChannels | Get list of notification channels | function | no | iOS/Android | yes | +| channelExists | Check if specified type channel exists | function | no | iOS/Android | yes | +| createChannel | Create notification channel | function | no | iOS/Android | yes | +| channelBlocked | Check if specified type channel is blocked | function | no | iOS/Android | yes | +| deleteChannel | Delete notification channel | function | no | iOS/Android | yes | +| requestPermissions | Request notification permissions | function | no | iOS/Android | yes | +| checkPermissions | Check notification permissions status | function | no | iOS/Android | yes | +| openNotifictionSetting | Open notification settings page | function | no | iOS/Android | yes | +| unregister | Unregister push service | function | no | iOS/Android | yes | +| isConfigured | Check if configured | function | no | iOS/Android | yes | +| popInitialNotification | Pop initial notification | function | no | iOS/Android | yes | +| createWantAgent | Create WantAgent | function | no | iOS/Android | yes | +| registerActionButton | Register notification button action | function | no | iOS/Android | yes | +| getPushToken | Get push token | function | no | iOS/Android | yes | + +## License + +This project is based on [The MIT License (MIT)](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2FDylanVann%2Freact-native-fast-image%2Fblob%2Fmain%2FLICENSE). Feel free to enjoy and participate in the open source. \ No newline at end of file diff --git a/zh-cn/react-native-push-notification.md b/zh-cn/react-native-push-notification.md new file mode 100644 index 00000000..c8ee6f3d --- /dev/null +++ b/zh-cn/react-native-push-notification.md @@ -0,0 +1,330 @@ +# React Native Push Notification + + React Native 推送通知库,提供全面的通知管理功能。 + +## 下载和使用 + +### npm + +```bash +npm install @react-native-oh-tpl/react-native-push-notification +``` + +### yarn + +```bash +yarn add @react-native-oh-tpl/react-native-push-notification +``` + +下面的代码展示了这个库的基本使用场景: + +使用时 import 的库名不变。 + +```jsx +import PushNotification from '@react-native-oh-tpl/react-native-push-notification'; + + const sendBasicNotification = async () => { + try { + if (!PushNotification) { + showAlert('错误', 'PushNotification模块不可用'); + return; + } + const options = { + title: '这是一条普通消息', + text: '这是普通消息的内容', + id: Date.now(), + notificationType: NotificationType.TEXT, + isFloatingIcon: true, + sound: 'rawfile/sound.mp3', + notificationSlotType: SlotType.SOCIAL_COMMUNICATION, + }; + + const id = await PushNotification.localNotification(JSON.stringify(options)); + if (id !== undefined) { + console.info(`Basic notification sent with id: ${id}`); + showAlert('成功', `通知已发送,ID: ${id}`); + } else { + console.error('Send basic notification failed'); + showAlert('失败', '发送通知失败'); + } + } catch (error) { + console.error('Send basic notification failed:', error); + showAlert('异常', `发送通知异常: ${error}`); + } + }; +``` + +#### ## Link + +| | 是否支持autolink | RN框架版本 | +| -------------------------- | ------------ | ------ | +| ~8.7.0 | No | 0.77 | +| ~8.6.4 | Yes | 0.72 | +| <= 8.6.3-0.4.17@deprecated | No | 0.72 | + +使用AutoLink的工程需要根据该文档配置,Autolink框架指导文档:[https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md](https://gitee.com/link?target=https%3A%2F%2Fgitcode.com%2Fopenharmony-sig%2Fohos_react_native%2Fblob%2Fmaster%2Fdocs%2Fzh-cn%2FAutolinking.md) +使用 AutoLink 的工程需要根据该文档配置,Autolink 框架指导文档: https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md + +如您使用的版本支持 Autolink,并且工程已接入 Autolink,可跳过ManualLink配置。 + +
+ ManualLink: 此步骤为手动配置原生依赖项的指导 + +首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。 + +### 1.在工程根目录的 `oh-package.json5` 添加 overrides 字段 + +```json +{ + ... + "overrides": { + "@rnoh/react-native-openharmony" : "./react_native_openharmony" + } +} +``` + +### 2.引入原生端代码 + +目前有两种方法: + +1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法); +2. 直接链接源码。 + +方法一:通过 har 包引入(推荐) + +> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。 + +打开 `entry/oh-package.json5`,添加以下依赖 + +```json +"dependencies": { + "@rnoh/react-native-openharmony": "file:../react_native_openharmony", + "@react-native-ohos/react-native-fast-image": "file:../../node_modules/@react-native-oh-tpl/react-native-push-notification/harmony/push_notification.har" + } +``` + +点击右上角的 `sync` 按钮 + +或者在终端执行: + +```bash +cd entry +ohpm install +``` + +方法二:直接链接源码 + +如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) + +### 3.配置 CMakeLists 和引入 PushNotificationPackage + +> 若使用的是 <= 8.6.3-0.4.17 版本,请跳过本章。 + +打开 `entry/src/main/cpp/CMakeLists.txt`,添加: + +```diff +project(rnapp) +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules") ++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") +set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp") +set(LOG_VERBOSITY_LEVEL 1) +set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments") +set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie") +set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use +add_compile_definitions(WITH_HITRACE_SYSTRACE) + +add_subdirectory("${RNOH_CPP_DIR}" ./rn) + +# RNOH_BEGIN: manual_package_linking_1 +add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) ++ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-push-notification/src/main/cpp" ./fast-image) +# RNOH_END: manual_package_linking_1 + +file(GLOB GENERATED_CPP_FILES "./generated/*.cpp") + +add_library(rnoh_app SHARED + ${GENERATED_CPP_FILES} + "./PackageProvider.cpp" + "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp" +) +target_link_libraries(rnoh_app PUBLIC rnoh) + +# RNOH_BEGIN: manual_package_linking_2 +target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) ++ target_link_libraries(rnoh_app PUBLIC rnoh_push_notification) +# RNOH_END: manual_package_linking_2 +``` + +打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: + +```diff +#include "RNOH/PackageProvider.h" +#include "generated/RNOHGeneratedPackage.h" +#include "SamplePackage.h" ++ #include "RTNPushNotificationPackage.h" + +using namespace rnoh; + +std::vector> PackageProvider::getPackages(Package::Context ctx) { + return { + std::make_shared(ctx), + std::make_shared(ctx), ++ std::make_shared(ctx), + }; +} +``` + +### 4.在 ArkTs 侧引入 PushNotificationPackage + +打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: + +```diff + ... ++ import {PushNotificationPackage} from '@react-native-oh-tpl/react-native-push-notification/ts'; + +export function createRNPackages(ctx: RNPackageContext): RNPackage[] { + return [ + new SamplePackage(ctx), ++ new FastImagePackage(ctx) + ]; +} +``` + +
+ +#### 运行 + +点击右上角的 `sync` 按钮 + +或者在终端执行: + +```bash +cd entry + +ohpm install +``` + +然后编译、运行即可。 + +## 约束与限制 + +### 兼容性 + +要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 + +在以下版本验证通过: + +1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; + +2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; + +3. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; + +## 属性 + +### NotificationOptions + +| Name | Type | Description | Required | Platform | HarmonyOS Support | +|-------------------------|-----------|------------------------------------------------|----------|-------------|-------------------| +| id | string | 通知ID | no | iOS/Android | yes | +| showDeliveryTime | boolean | 是否显示分发时间 | no | iOS/Android | yes | +| tapDismissed | boolean | 通知是否自动清除 | no | iOS/Android | yes | +| autoDeletedTime | number | 自动清除的时间 | no | iOS/Android | yes | +| wantAgent | object | WantAgent封装了应用的行为意图,点击通知时触发该行为 | no | iOS/Android | yes | +| extraInfo | object | 扩展参数 | no | iOS/Android | yes | +| isAlertOnce | boolean | 设置是否仅有一次此通知提醒 | no | iOS/Android | yes | +| isStopwatch | boolean | 是否显示已用时间 | no | iOS/Android | yes | +| isCountDown | boolean | 是否显示倒计时时间 | no | iOS/Android | yes | +| isFloatingIcon | boolean | 是否显示状态栏图标 | no | iOS/Android | yes | +| label | string | 通知标签 | no | iOS/Android | yes | +| smallIcon | string | 小图标(Base64编码或资源路径) | no | iOS/Android | yes | +| largeIcon | string | 大图标(Base64编码或资源路径) | no | iOS/Android | yes | +| lockscreenPicture | string | 锁屏界面显示的图片 | no | iOS/Android | yes | +| notificationType | string | 通知类型(TEXT, LONGTEXT, LINES, PICTURE, PROGRESS) | no | iOS/Android | yes | +| title | string | 通知标题 | no | iOS/Android | yes | +| text | string | 通知内容 | no | iOS/Android | yes | +| additionalText | string | 通知附加内容 | no | iOS/Android | yes | +| briefText | string | 通知概要内容 | no | iOS/Android | yes | +| longText | string | 通知的长文本 | no | iOS/Android | yes | +| expandedTitle | string | 通知展开时的标题 | no | iOS/Android | yes | +| picture | string | 图片通知的图片(Base64编码或资源路径) | no | iOS/Android | yes | +| fileName | string | 下载文件名(进度条通知) | no | iOS/Android | yes | +| progressValue | number | 下载进度(进度条通知) | no | iOS/Android | yes | +| fireDate | Date | 计划通知触发时间 | no | iOS/Android | yes | +| actionButtons | array | 通知按钮数组 | no | iOS/Android | yes | +| groupName | string | 组通知名称 | no | iOS/Android | yes | +| notificationSlotType | string | 通知渠道类型 | no | iOS/Android | yes | +| repeatType | string | 重复类型(minute, hour, day, week, month, time) | no | iOS/Android | yes | +| repeatTime | number | 重复间隔时间 | no | iOS/Android | yes | +| repeatInterval | number | 重复间隔(毫秒) | no | iOS/Android | yes | +| repeatCount | number | 重复次数(-1表示无限重复) | no | iOS/Android | yes | + +### NotificationType 枚举 + +| Name | Type | Description | Required | Platform | HarmonyOS Support | +|-----------|--------|--------------|----------|-------------|-------------------| +| TEXT | string | 基本文本通知 | no | iOS/Android | yes | +| LONGTEXT | string | 长文本通知 | no | iOS/Android | yes | +| LINES | string | 多行文本通知 | no | iOS/Android | yes | +| PICTURE | string | 图片通知 | no | iOS/Android | yes | +| PROGRESS | string | 进度条通知 | no | iOS/Android | yes | + +### SlotType 枚举 + +| Name | Type | Description | Required | Platform | HarmonyOS Support | +|-----------------------|--------|--------------|----------|-------------|-------------------| +| UNKNOWN_TYPE | string | 未知类型 | no | iOS/Android | yes | +| SOCIAL_COMMUNICATION | string | 社交通讯 | no | iOS/Android | yes | +| SERVICE_INFORMATION | string | 服务信息 | no | iOS/Android | yes | +| CONTENT_INFORMATION | string | 内容信息 | no | iOS/Android | yes | +| LIVE_VIEW | string | 直播观看 | no | iOS/Android | yes | +| CUSTOMER_SERVICE | string | 客户服务 | no | iOS/Android | yes | +| OTHER_TYPES | string | 其他类型 | no | iOS/Android | yes | + +### SlotLevel 枚举 + +| Name | Type | Description | Required | Platform | HarmonyOS Support | +|---------------|--------|--------------|----------|-------------|-------------------| +| LEVEL_NONE | string | 无级别 | no | iOS/Android | yes | +| LEVEL_MIN | string | 最低级别 | no | iOS/Android | yes | +| LEVEL_LOW | string | 低级别 | no | iOS/Android | yes | +| LEVEL_DEFAULT | string | 默认级别 | no | iOS/Android | yes | +| LEVEL_HIGH | string | 高级别 | no | iOS/Android | yes | + +## 静态方法 + +| Name | Description | Type | Required | Platform | HarmonyOS Support | +| ------------------------------- | -------------- | -------- | -------- | ---------- | ----------------- | +| configure | 配置推送通知服务 | function | no | iOS/Android | yes | +| localNotification | 发送本地通知 | function | no | iOS/Android | yes | +| cancelLocalNotification | 取消指定ID的本地通知 | function | no | iOS/Android | yes | +| cancelAllLocalNotifications | 取消所有本地通知 | function | no | iOS/Android | yes | +| setApplicationIconBadgeNumber | 设置应用图标徽章数字 | function | no | iOS/Android | yes | +| getApplicationIconBadgeNumber | 获取应用图标徽章数字 | function | no | iOS/Android | yes | +| clearBadge | 清除徽章 | function | no | iOS/Android | yes | +| clearAllNotifications | 清除所有通知 | function | no | iOS/Android | yes | +| removeAllDeliveredNotifications | 移除所有已送达的通知 | function | no | iOS/Android | yes | +| getDeliveredNotifications | 获取已送达的通知列表 | function | no | iOS/Android | yes | +| getScheduledLocalNotifications | 获取计划中的本地通知 | function | no | iOS/Android | yes | +| removeDeliveredNotifications | 移除指定ID的已送达通知 | function | no | iOS/Android | yes | +| getChannels | 获取通知渠道列表 | function | no | iOS/Android | yes | +| channelExists | 检查指定类型的渠道是否存在 | function | no | iOS/Android | yes | +| createChannel | 创建通知渠道 | function | no | iOS/Android | yes | +| channelBlocked | 检查指定类型的渠道是否被阻止 | function | no | iOS/Android | yes | +| deleteChannel | 删除通知渠道 | function | no | iOS/Android | yes | +| requestPermissions | 请求通知权限 | function | no | iOS/Android | yes | +| checkPermissions | 检查通知权限状态 | function | no | iOS/Android | yes | +| openNotifictionSetting | 打开通知设置页面 | function | no | iOS/Android | yes | +| unregister | 注销推送服务 | function | no | iOS/Android | yes | +| isConfigured | 检查是否已配置 | function | no | iOS/Android | yes | +| popInitialNotification | 弹出初始通知 | function | no | iOS/Android | yes | +| createWantAgent | 创建WantAgent | function | no | iOS/Android | yes | +| registerActionButton | 注册通知按钮动作 | function | no | iOS/Android | yes | +| getPushToken | 获取推送令牌 | function | no | iOS/Android | yes | + +## 开源协议 + +本项目基于 [The MIT License (MIT)](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2FDylanVann%2Freact-native-fast-image%2Fblob%2Fmain%2FLICENSE) ,请自由地享受和参与开源。 \ No newline at end of file -- Gitee