未验证 提交 373e918e 编写于 作者: O openharmony_ci 提交者: Gitee

!21217 翻译完成 21017+19717+20587+20707:事件通知资料仓一致性整改

Merge pull request !21217 from ester.zhou/TR-21017
...@@ -9,6 +9,12 @@ You can use the APIs of this module to start StaticSubscriberExtensionAbilities. ...@@ -9,6 +9,12 @@ You can use the APIs of this module to start StaticSubscriberExtensionAbilities.
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model. > The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import StaticSubscriberExtensionContext from '@ohos.application.StaticSubscriberExtensionContext'
```
## Usage ## Usage
Before using the **StaticSubscriberExtensionContext** module, you must first obtain a **StaticSubscriberExtensionAbility** instance. Before using the **StaticSubscriberExtensionContext** module, you must first obtain a **StaticSubscriberExtensionAbility** instance.
...@@ -31,6 +37,8 @@ Observe the following when using this API: ...@@ -31,6 +37,8 @@ Observe the following when using this API:
- If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission.
- If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission.
**Required permissions**: ohos.permission.START_ABILITIES_FROM_BACKGROUND
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
...@@ -98,6 +106,8 @@ Observe the following when using this API: ...@@ -98,6 +106,8 @@ Observe the following when using this API:
- If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission.
- If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission.
**Required permissions**: ohos.permission.START_ABILITIES_FROM_BACKGROUND
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
......
...@@ -4,7 +4,7 @@ The **StaticSubscriberExtensionAbility** module provides Extension abilities for ...@@ -4,7 +4,7 @@ The **StaticSubscriberExtensionAbility** module provides Extension abilities for
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> >
> The APIs of this module can be used only in the stage model. > The APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
...@@ -15,11 +15,13 @@ import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriber ...@@ -15,11 +15,13 @@ import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriber
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------- | ------------------------------------------------------------ | ---- | ---- | -------- | | ------- | ------------------------------------------------------------ | ---- | ---- | -------- |
| context | [StaticSubscriberExtensionContext](js-apis-application-StaticSubscriberExtensionContext.md) | Yes | No | Context.| | context<sup>10+</sup> | [StaticSubscriberExtensionContext](js-apis-application-StaticSubscriberExtensionContext.md) | Yes | No | Context.|
## StaticSubscriberExtensionAbility.onReceiveEvent ## StaticSubscriberExtensionAbility.onReceiveEvent
......
...@@ -93,9 +93,36 @@ Unsubscribes from an event. ...@@ -93,9 +93,36 @@ Unsubscribes from an event.
**Example** **Example**
```javascript ```javascript
// Unregister the callbacks of all events whose eventID is 1.
emitter.off(1); emitter.off(1);
``` ```
## emitter.off<sup>10+<sup>
off(eventId: number, callback: Callback\<[EventData](#eventdata)\>): void
Unsubscribes from an event. If the specified callback has been registered through the **on** or **once** API, it is unregistered. Otherwise, no processing is performed.
**System capability**: SystemCapability.Notification.Emitter
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------ |
| eventId | number | Yes | Event ID.|
| callback<sup>10+</sup> | Callback\<[EventData](#eventdata)\> | Yes | Callback to unregister. |
**Example**
```javascript
// Unregister the emitterCallback callback for the event whose eventID is 1.
// If the callback has not been registered, no processing is performed.
function emitterCallback() {
console.info('callback');
}
emitter.off(1, emitterCallback);
```
## emitter.emit ## emitter.emit
emit(event: [InnerEvent](#innerevent), data?: [EventData](#eventdata)): void emit(event: [InnerEvent](#innerevent), data?: [EventData](#eventdata)): void
......
# CommonEventData # CommonEventData
The **CommonEventData** module provides APIs for defining common event data.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Attributes
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
......
# CommonEventPublishData # CommonEventPublishData
The **CommonEventPublishData** module provides APIs for defining common event content and attributes.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Attributes
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Attributes
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
......
# NotificationActionButton # NotificationActionButton
The **NotificationActionButton** module describes the button displayed in the notification. The **NotificationActionButton** module provides APIs for defining the button displayed in the notification.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Attributes
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Read-only| Mandatory| Description |
......
# NotificationContent # NotificationContent
The **NotificationContent** module describes the notification content. The **NotificationContent** module provides APIs for defining the notification content.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## NotificationContent
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Read-only| Mandatory| Description |
...@@ -22,11 +24,11 @@ Describes the normal text notification. ...@@ -22,11 +24,11 @@ Describes the normal text notification.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | ---- | ---------------------------------- | | -------------- | ------ | ---- | ---------------------------------- |
| title | string | No | Yes | Notification title. | | title | string | Yes | Notification title. |
| text | string | No | Yes | Notification content. | | text | string | Yes | Notification content. |
| additionalText | string | No | No | Additional information of the notification.| | additionalText | string | No | Additional information of the notification.|
## NotificationLongTextContent ## NotificationLongTextContent
...@@ -35,14 +37,14 @@ Describes the long text notification. ...@@ -35,14 +37,14 @@ Describes the long text notification.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | --- | -------------------------------- | | -------------- | ------ | --- | -------------------------------- |
| title | string | No | Yes | Notification title. | | title | string | Yes | Notification title. |
| text | string | No | Yes | Notification content. | | text | string | Yes | Notification content. |
| additionalText | string | No | No | Additional information of the notification.| | additionalText | string | No | Additional information of the notification. |
| longText | string | No | Yes | Long text of the notification. | | longText | string | Yes | Long text of the notification. |
| briefText | string | No | Yes | Brief text of the notification. | | briefText | string | Yes | Brief text of the notification. |
| expandedTitle | string | No | Yes | Title of the notification in the expanded state. | | expandedTitle | string | Yes | Title of the notification in the expanded state. |
## NotificationMultiLineContent ## NotificationMultiLineContent
...@@ -67,11 +69,11 @@ Describes the picture-attached notification. ...@@ -67,11 +69,11 @@ Describes the picture-attached notification.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| -------------- | -------------- | ---- | --- | -------------------------------- | | -------------- | -------------- | ---- | --- |-------------|
| title | string | No | Yes | Notification title. | | title | string | No | Yes | Notification title. |
| text | string | No | Yes | Notification content. | | text | string | No | Yes | Notification content. |
| additionalText | string | No | No | Additional information of the notification.| | additionalText | string | No | No | Additional information of the notification.|
| briefText | string | No | Yes | Brief text of the notification.| | briefText | string | No | Yes | Brief text of the notification.|
| expandedTitle | string | No | Yes | Title of the notification in the expanded state. | | expandedTitle | string | No | Yes | Title of the notification in the expanded state. |
| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | No | Yes | Picture attached to the notification. | | picture | [image.PixelMap](js-apis-image.md#pixelmap7) | No | Yes | Picture attached to the notification. The maximum size is 2 MB. |
...@@ -8,10 +8,10 @@ The **NotificationFlags** module implements a **NotificationFlags** instance. ...@@ -8,10 +8,10 @@ The **NotificationFlags** module implements a **NotificationFlags** instance.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------------- | ---------------------- | ---- | ---- | --------------------------------- | | ---------------- | ---------------------- | ---- | --------------------------------- |
| soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | Yes | No | Whether to enable the sound alert for the notification. | | soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | No | Whether to enable the sound alert for the notification. |
| vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | Yes | No | Whether to enable vibration for the notification. | | vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | No | Whether to enable vibration for the notification. |
## NotificationFlagStatus ## NotificationFlagStatus
......
# NotificationRequest # NotificationRequest
The **NotificationRequest** module describes the notification request. The **NotificationRequest** module provides APIs for defining the notification request.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## NotificationRequest
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- | | --------------------- | --------------------------------------------- | --- | -------------------------- |
| content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | No | Yes | Notification content. | | content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | Yes | Notification content. |
| id | number | No | No | Notification ID. | | id | number | No | Notification ID. |
| slotType | [SlotType](js-apis-notificationManager.md#slottype) | Yes | No | Notification slot type. | | slotType | [SlotType](js-apis-notificationManager.md#slottype) | No | Notification slot type. |
| isOngoing | boolean | No | No | Whether the notification is an ongoing notification. | | isOngoing | boolean | No | Whether the notification is an ongoing notification. |
| isUnremovable | boolean | No | No | Whether the notification can be removed. | | isUnremovable | boolean | No | Whether the notification can be removed. |
| deliveryTime | number | No | No | Time when the notification is sent. | | deliveryTime | number | No | Time when the notification is sent. |
| tapDismissed | boolean | No | No | Whether the notification is automatically cleared. | | tapDismissed | boolean | No | Whether the notification is automatically cleared. |
| autoDeletedTime | number | No | No | Time when the notification is automatically cleared. | | autoDeletedTime | number | No | Time when the notification is automatically cleared. |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | No | No | **WantAgent** instance to which the notification will be redirected after being clicked.| | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | No | **WantAgent** instance to which the notification will be redirected after being clicked.|
| extraInfo | {[key: string]: any} | No | No | Extended parameters. | | extraInfo | {[key: string]: any} | No | Extended parameters. |
| color | number | No | No | Background color of the notification. Not supported currently.| | color | number | No | Background color of the notification. Not supported currently.|
| colorEnabled | boolean | No | No | Whether the notification background color can be enabled. Not supported currently.| | colorEnabled | boolean | No | Whether the notification background color can be enabled. Not supported currently.|
| isAlertOnce | boolean | No | No | Whether the notification triggers an alert only once.| | isAlertOnce | boolean | No | Whether the notification triggers an alert only once.|
| isStopwatch | boolean | No | No | Whether to display the stopwatch. | | isStopwatch | boolean | No | Whether to display the stopwatch. |
| isCountDown | boolean | No | No | Whether to display the countdown time. | | isCountDown | boolean | No | Whether to display the countdown time. |
| isFloatingIcon | boolean | No | No | Whether the notification is displayed as a floating icon in the status bar. | | isFloatingIcon | boolean | No | Whether the notification is displayed as a floating icon in the status bar. |
| label | string | No | No | Notification label. | | label | string | No | Notification label. |
| badgeIconStyle | number | No | No | Notification badge type. Not supported currently. | | badgeIconStyle | number | No | Notification badge type. Not supported currently. |
| showDeliveryTime | boolean | No | No | Whether to display the time when the notification is delivered. | | showDeliveryTime | boolean | No | Whether to display the time when the notification is delivered. |
| actionButtons | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\> | No | No | Buttons in the notification. Up to three buttons are allowed. | | actionButtons | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\> | No | Buttons in the notification. Up to three buttons are allowed. |
| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | No | No | Small notification icon. This field is optional, and the icon size cannot exceed 30 KB.| | smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | No | Small notification icon. This field is optional, and the icon size cannot exceed 30 KB.|
| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | No | No | Large notification icon. This field is optional, and the icon size cannot exceed 30 KB.| | largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | No | Large notification icon. This field is optional, and the icon size cannot exceed 30 KB.|
| creatorBundleName | string | Yes | No | Name of the bundle that creates the notification. | | creatorBundleName | string | No | Name of the bundle that creates the notification. |
| creatorUid<sup>8+<sup> | number | Yes | No | UID used for creating the notification. | | creatorUid | number | No | UID used for creating the notification. |
| creatorPid | number | Yes | No | PID used for creating the notification. | | creatorPid | number | No | PID used for creating the notification. |
| creatorUserId | number | Yes | No | ID of the user who creates the notification. | | creatorUserId<sup>8+<sup> | number | No | ID of the user who creates the notification. |
| hashCode | string | Yes | No | Unique ID of the notification. | | hashCode | string | No | Unique ID of the notification. |
| classification | string | No | No | Notification category.<br>**System API**: This is a system API and cannot be called by third-party applications. | | classification | string | No | Notification category.<br>**System API**: This is a system API and cannot be called by third-party applications. |
| groupName<sup>8+<sup> | string | No | No | Notification group name. | | groupName<sup>8+<sup> | string | No | Notification group name. |
| template<sup>8+<sup> | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | No | No | Notification template. | | template<sup>8+<sup> | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | No | Notification template. |
| isRemoveAllowed<sup>8+<sup> | boolean | Yes | No | Whether the notification can be removed.<br>**System API**: This is a system API and cannot be called by third-party applications. | | isRemoveAllowed<sup>10+<sup> | boolean | No | Whether the notification can be removed.<br>**System API**: This is a system API and cannot be called by third-party applications. |
| source<sup>8+<sup> | number | Yes | No | Notification source.<br>**System API**: This is a system API and cannot be called by third-party applications. | | source<sup>8+<sup> | number | No | Notification source.<br>**System API**: This is a system API and cannot be called by third-party applications. |
| distributedOption<sup>8+<sup> | [DistributedOptions](#distributedoptions) | No | No | Distributed notification options. | | distributedOption<sup>8+<sup> | [DistributedOptions](#distributedoptions) | No | Distributed notification options. |
| deviceId<sup>8+<sup> | string | Yes | No | Device ID of the notification source.<br>**System API**: This is a system API and cannot be called by third-party applications. | | deviceId<sup>8+<sup> | string | No | Device ID of the notification source.<br>**System API**: This is a system API and cannot be called by third-party applications. |
| notificationFlags<sup>8+<sup> | [NotificationFlags](js-apis-inner-notification-notificationFlags.md#notificationflags) | Yes | No | Notification flags. | | notificationFlags<sup>8+<sup> | [NotificationFlags](js-apis-inner-notification-notificationFlags.md#notificationflags) | No | Notification flags. |
| removalWantAgent<sup>9+<sup> | [WantAgent](js-apis-app-ability-wantAgent.md) | No | No | **WantAgent** instance to which the notification will be redirected when it is removed. | | removalWantAgent<sup>9+<sup> | [WantAgent](js-apis-app-ability-wantAgent.md) | No | **WantAgent** instance to which the notification will be redirected when it is removed. |
| badgeNumber<sup>9+<sup> | number | No | No | Number of notifications displayed on the application icon. | | badgeNumber<sup>9+<sup> | number | No | Number of notifications displayed on the application icon. |
## DistributedOptions ## DistributedOptions
...@@ -55,9 +57,9 @@ Describes distributed notification options. ...@@ -55,9 +57,9 @@ Describes distributed notification options.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------------------- | -------------- | ---- | ---- | ---------------------------------- | | ---------------------- | -------------- | ---- | ---------------------------------- |
| isDistributed<sup>8+<sup> | boolean | No | No | Whether the notification is a distributed notification. | | isDistributed<sup>8+<sup> | boolean | No | Whether the notification is a distributed notification. |
| supportDisplayDevices<sup>8+<sup> | Array\<string> | No | No | List of the devices to which the notification can be synchronized. | | supportDisplayDevices<sup>8+<sup> | Array\<string> | No | List of the devices to which the notification can be synchronized. |
| supportOperateDevices<sup>8+<sup> | Array\<string> | No | No | List of the devices on which the notification can be opened. | | supportOperateDevices<sup>8+<sup> | Array\<string> | No | List of the devices on which the notification can be opened. |
| remindType<sup>8+<sup> | number | Yes | No | Notification reminder type.<br>**System API**: This is a system API and cannot be called by third-party applications. | | remindType<sup>8+<sup> | number | No | Notification reminder type.<br>**System API**: This is a system API and cannot be called by third-party applications. |
# NotificationSlot # NotificationSlot
The **NotificationSlot** module describes the notification slot. The **NotificationSlot** module provides APIs for defining the notification slot.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## NotificationSlot
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | | -------------------- | --------------------- | --- | ------------------------------------------ |
| type | [SlotType](js-apis-notificationManager.md#slottype) | No | Yes | Notification slot type. | | type | [SlotType](js-apis-notificationManager.md#slottype) | Yes | Notification slot type. |
| level | number | No | No | Notification level. If this parameter is not set, the default value that corresponds to the notification slot type is used.| | level | number | No | Notification level. If this parameter is not set, the default value that corresponds to the notification slot type is used.|
| desc | string | No | No | Notification slot description. | | desc | string | No | Notification slot description. |
| badgeFlag | boolean | No | No | Whether to display the badge. | | badgeFlag | boolean | No | Whether to display the badge. |
| bypassDnd | boolean | No | No | Whether to bypass DND mode in the system. | | bypassDnd | boolean | No | Whether to bypass DND mode in the system. |
| lockscreenVisibility | number | No | No | Mode for displaying the notification on the lock screen. | | lockscreenVisibility | number | No | Mode for displaying the notification on the lock screen. |
| vibrationEnabled | boolean | No | No | Whether to enable vibration for the notification. | | vibrationEnabled | boolean | No | Whether to enable vibration for the notification. |
| sound | string | No | No | Notification alert tone. | | sound | string | No | Notification alert tone. |
| lightEnabled | boolean | No | No | Whether the indicator blinks for the notification. | | lightEnabled | boolean | No | Whether the indicator blinks for the notification. |
| lightColor | number | No | No | Indicator color of the notification. | | lightColor | number | No | Indicator color of the notification. |
| vibrationValues | Array\<number\> | No | No | Vibration mode of the notification. | | vibrationValues | Array\<number\> | No | Vibration mode of the notification. |
| enabled<sup>9+</sup> | boolean | Yes | No | Whether the notification slot is enabled. | | enabled<sup>9+</sup> | boolean | No | Whether the notification slot is enabled. |
# NotificationSorting # NotificationSorting
Provides sorting information of active notifications. The **NotificationSorting** module provides APIs for defining the sorting information of active notifications.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Attributes
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | | -------------------- | --------------------- | --- | ------------------------------------------ |
| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | Yes | Yes | Notification slot type. | | slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | Yes | Notification slot type. |
| level | number | Yes | Yes | Notification level. If this parameter is not set, the default value is used based on the notification slot type.| | level | number | Yes | Notification level. If this parameter is not set, the default value is used based on the notification slot type.|
| desc | string | Yes | Yes | Description of the notification slot. | | desc | string | Yes | Description of the notification slot. |
# NotificationSortingMap # NotificationSortingMap
Provides sorting information of active notifications in all subscribed notifications. The **NotificationSortingMap** module provides APIs for defining the sorting information of active notifications in all subscribed notifications.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Attributes
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | | -------------------- | --------------------- | --- | ------------------------------------------ |
| sortings | { [key: string]: [NotificationSorting](js-apis-inner-notification-notificationSorting.md) } | Yes | Yes | Array of notification sorting information.| | sortings | { [key: string]: [NotificationSorting](js-apis-inner-notification-notificationSorting.md) } | Yes | Array of notification sorting information.|
| sortedHashCode | Array\<string> | Yes | Yes | Hash codes for notification sorting.| | sortedHashCode | Array<string> | Yes | Hash codes for notification sorting.|
# NotificationSubscribeInfo # NotificationSubscribeInfo
Provides the information about the publisher for notification subscription. The **NotificationSubscribeInfo** module provides APIs for defining the information about the publisher for notification subscription.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## NotificationSubscribeInfo
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | | -------------------- | --------------------- | --- | ------------------------------------------ |
| bundleNames | Array\<string> | No | No | Bundle names of the applications whose notifications are to be subscribed to. | | bundleNames | Array<string> | No | Bundle names of the applications whose notifications are to be subscribed to. |
| userId | number | No | No | User ID. | | userId | number | No | User ID. |
# NotificationSubscriber # NotificationSubscriber
Provides callbacks for receiving or removing notifications and serves as the input parameter of [subscribe](js-apis-notificationSubscribe.md). The **NotificationSubscriber** module provides callbacks for receiving or removing notifications and serves as the input parameter of [subscribe](js-apis-notificationSubscribe.md).
> **NOTE** > **NOTE**
> >
...@@ -283,7 +283,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -283,7 +283,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
### onEnabledNotificationChanged<sup>8+</sup> ### onEnabledNotificationChanged<sup>8+</sup>
onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata8)) => void onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)) => void
Listens for the notification enabled status changes. Listens for the notification enabled status changes.
...@@ -295,7 +295,7 @@ Listens for the notification enabled status changes. ...@@ -295,7 +295,7 @@ Listens for the notification enabled status changes.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ------------ | ------------------------ | ---- | -------------------------- | | ------------ | ------------------------ | ---- | -------------------------- |
| callback | AsyncCallback\<[EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata8)\> | Yes| Callback used to return the result.| | callback | AsyncCallback\<[EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)\> | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -367,9 +367,9 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -367,9 +367,9 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Readable| Writable| Description |
| --------------- | ------------------------------------------------- | ---- | --- | -------- | | --------------- | ------------------------------------------------- | ---- | --- | -------- |
| request | [NotificationRequest](js-apis-inner-notification-notificationRequest#notificationrequest) | Yes | Yes | Notification content.| | request | [NotificationRequest](js-apis-inner-notification-notificationRequest#notificationrequest) | Yes | No | Notification content.|
| sortingMap | [NotificationSortingMap](js-apis-inner-notification-notificationSortingMap.md) | Yes | No | Notification sorting information.| | sortingMap | [NotificationSortingMap](js-apis-inner-notification-notificationSortingMap.md) | Yes | No | Notification sorting information.|
| reason | number | Yes | No | Reason for deletion.| | reason | number | Yes | No | Reason for deletion.|
| sound | string | Yes | No | Sound used for notification.| | sound | string | Yes | No | Sound used for notification.|
...@@ -382,11 +382,11 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -382,11 +382,11 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Readable| Writable| Description |
| ------ | ------- | ---- | --- | ---------------- | | ------ | ------- | ---- | --- | ---------------- |
| bundle | string | Yes | Yes | Bundle name of the application. | | bundle | string | Yes | No | Bundle name of the application. |
| uid | number | Yes | Yes | UID of the application. | | uid | number | Yes | No | UID of the application. |
| enable | boolean | Yes | Yes | Notification enabled status of the application.| | enable | boolean | Yes | No | Notification enabled status of the application.|
## BadgeNumberCallbackData<sup>10+</sup> ## BadgeNumberCallbackData<sup>10+</sup>
...@@ -395,8 +395,8 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -395,8 +395,8 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Readable| Writable| Description |
| ----------- | ------ | ---- | ---- | ------------ | | ----------- | ------ | ---- | ---- | ------------ |
| bundle | string | Yes | Yes | Bundle name of the application.| | bundle | string | Yes | No | Bundle name of the application.|
| uid | number | Yes | Yes | UID of the application. | | uid | number | Yes | No | UID of the application. |
| badgeNumber | number | Yes | Yes | Number of notifications displayed on the application icon. | | badgeNumber | number | Yes | No | Number of notifications displayed on the application icon. |
...@@ -6,9 +6,11 @@ The **NotificationTemplate** module describes the notification template. ...@@ -6,9 +6,11 @@ The **NotificationTemplate** module describes the notification template.
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Attributes
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name| Type | Read-only| Mandatory| Description | | Name| Type | Mandatory| Description |
| ---- | ---------------------- | ---- | ---- | ---------- | | ---- | ---------------------- | ---- | ---------- |
| name | string | No | Yes | Template name.| | name | string | Yes | Template name.|
| data | {[key:string]: Object} | No | Yes | Template data.| | data | {[key:string]: Object} | Yes | Template data.|
# NotificationUserInput # NotificationUserInput
The **NotificationUserInput** module provides the notification user input. The **NotificationUserInput** module provides APIs for defining the notification user input.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## NotificationUserInput
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Type | Read-only| Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------ | --- | ---- | ----------------------------- | | -------- | ------ | ---- | ----------------------------- |
| inputKey | string | No | Yes | Key to identify the user input.| | inputKey | string | Yes | Key to identify the user input.|
...@@ -3972,12 +3972,12 @@ try{ ...@@ -3972,12 +3972,12 @@ try{
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
| Name | Value | Description | | Name | Value | Description |
| --------------------------------- | ----------- | ------------------ | | --------------------------------- | ----------- |------------------|
| NOTIFICATION_CONTENT_BASIC_TEXT | NOTIFICATION_CONTENT_BASIC_TEXT | Normal text notification. | | NOTIFICATION_CONTENT_BASIC_TEXT | NOTIFICATION_CONTENT_BASIC_TEXT | Normal text notification. |
| NOTIFICATION_CONTENT_LONG_TEXT | NOTIFICATION_CONTENT_LONG_TEXT | Long text notification. | | NOTIFICATION_CONTENT_LONG_TEXT | NOTIFICATION_CONTENT_LONG_TEXT | Long text notification. |
| NOTIFICATION_CONTENT_PICTURE | NOTIFICATION_CONTENT_PICTURE | Picture-attached notification. | | NOTIFICATION_CONTENT_PICTURE | NOTIFICATION_CONTENT_PICTURE | Picture-attached notification. |
| NOTIFICATION_CONTENT_CONVERSATION | NOTIFICATION_CONTENT_CONVERSATION | Conversation notification. | | NOTIFICATION_CONTENT_CONVERSATION | NOTIFICATION_CONTENT_CONVERSATION | Conversation notification (not supported currently).|
| NOTIFICATION_CONTENT_MULTILINE | NOTIFICATION_CONTENT_MULTILINE | Multi-line text notification.| | NOTIFICATION_CONTENT_MULTILINE | NOTIFICATION_CONTENT_MULTILINE | Multi-line text notification. |
## SlotLevel ## SlotLevel
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册