未验证 提交 377bccdb 编写于 作者: O openharmony_ci 提交者: Gitee

!18922 翻译完成:18367【cherry-pick】Fix consistency issues & error code issues of Notification

Merge pull request !18922 from wusongqing/TR18367
# @ohos.reminderAgent (Reminder Agent) # @ohos.reminderAgent (reminderAgent)
The **reminderAgent** module provides APIs for publishing scheduled reminders through the reminder agent. The **reminderAgent** module provides APIs for publishing scheduled reminders through the reminder agent.
...@@ -13,19 +13,21 @@ You can use the APIs to create scheduled reminders for countdown timers, calenda ...@@ -13,19 +13,21 @@ You can use the APIs to create scheduled reminders for countdown timers, calenda
## Modules to Import ## Modules to Import
```ts ```js
import reminderAgent from'@ohos.reminderAgent'; import reminderAgent from'@ohos.reminderAgent';
``` ```
## reminderAgent.publishReminder ## reminderAgent.publishReminder<sup>(deprecated)</sup>
```ts publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback&lt;number&gt;): void
publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback<number>): void
```
Publishes a reminder through the reminder agent. This API uses an asynchronous callback to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8). Publishes a reminder through the reminder agent. This API uses an asynchronous callback to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8).
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.publishReminder](js-apis-reminderAgentManager.md#reminderagentmanagerpublishreminder).
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER **Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
...@@ -35,29 +37,30 @@ Publishes a reminder through the reminder agent. This API uses an asynchronous c ...@@ -35,29 +37,30 @@ Publishes a reminder through the reminder agent. This API uses an asynchronous c
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.| | reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
| callback | AsyncCallback\<number\> | Yes| Callback used to return the published reminder's ID.| | callback | AsyncCallback&lt;number&gt; | Yes| Callback used to return the published reminder's ID.|
**Example** **Example**
```ts ```js
let timer = { let timer = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER, reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 10 triggerTimeInSeconds: 10
} }
reminderAgent.publishReminder(timer, (err, reminderId) => { reminderAgent.publishReminder(timer, (err, reminderId) => {
console.log("callback, reminderId = " + reminderId); console.log("callback, reminderId = " + reminderId);
}); });
``` ```
## reminderAgent.publishReminder ## reminderAgent.publishReminder<sup>(deprecated)</sup>
```ts publishReminder(reminderReq: ReminderRequest): Promise&lt;number&gt;
publishReminder(reminderReq: ReminderRequest): Promise<number>
```
Publishes a reminder through the reminder agent. This API uses a promise to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8). Publishes a reminder through the reminder agent. This API uses a promise to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8).
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.publishReminder](js-apis-reminderAgentManager.md#reminderagentmanagerpublishreminder-1).
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER **Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
...@@ -70,29 +73,30 @@ Publishes a reminder through the reminder agent. This API uses a promise to retu ...@@ -70,29 +73,30 @@ Publishes a reminder through the reminder agent. This API uses a promise to retu
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<number\> | Promise used to return the published reminder's ID.| | Promise&lt;number&gt; | Promise used to return the published reminder's ID.|
**Example** **Example**
```ts ```js
let timer = { let timer = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER, reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 10 triggerTimeInSeconds: 10
} }
reminderAgent.publishReminder(timer).then((reminderId) => { reminderAgent.publishReminder(timer).then((reminderId) => {
console.log("promise, reminderId = " + reminderId); console.log("promise, reminderId = " + reminderId);
}); });
``` ```
## reminderAgent.cancelReminder ## reminderAgent.cancelReminder<sup>(deprecated)</sup>
```ts cancelReminder(reminderId: number, callback: AsyncCallback&lt;void&gt;): void
cancelReminder(reminderId: number, callback: AsyncCallback<void>): void
```
Cancels the reminder with the specified ID. This API uses an asynchronous callback to return the cancellation result. Cancels the reminder with the specified ID. This API uses an asynchronous callback to return the cancellation result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelReminder](js-apis-reminderAgentManager.md#reminderagentmanagercancelreminder).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Parameters** **Parameters**
...@@ -100,25 +104,27 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba ...@@ -100,25 +104,27 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| reminderId | number | Yes| ID of the reminder to cancel. The value is obtained by calling [publishReminder](#reminderagentpublishreminder).| | reminderId | number | Yes| ID of the reminder to cancel. The value is obtained by calling [publishReminder](#reminderagentpublishreminder).|
| callback | AsyncCallback\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
```ts ```js
reminderAgent.cancelReminder(1, (err, data) => { reminderAgent.cancelReminder(1, (err, data) => {
console.log("cancelReminder callback"); console.log("cancelReminder callback");
}); });
``` ```
## reminderAgent.cancelReminder ## reminderAgent.cancelReminder<sup>(deprecated)</sup>
```ts cancelReminder(reminderId: number): Promise\<void>
cancelReminder(reminderId: number): Promise<void>
```
Cancels the reminder with the specified ID. This API uses a promise to return the cancellation result. Cancels the reminder with the specified ID. This API uses a promise to return the cancellation result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelReminder](js-apis-reminderAgentManager.md#reminderagentmanagercancelreminder-1).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Parameters** **Parameters**
...@@ -131,35 +137,37 @@ Cancels the reminder with the specified ID. This API uses a promise to return th ...@@ -131,35 +137,37 @@ Cancels the reminder with the specified ID. This API uses a promise to return th
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<void\> | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
```ts ```js
reminderAgent.cancelReminder(1).then(() => { reminderAgent.cancelReminder(1).then(() => {
console.log("cancelReminder promise"); console.log("cancelReminder promise");
}); });
``` ```
## reminderAgent.getValidReminders ## reminderAgent.getValidReminders<sup>(deprecated)</sup>
```ts getValidReminders(callback: AsyncCallback\<Array\<ReminderRequest>>): void
getValidReminders(callback: AsyncCallback<Array<ReminderRequest>>): void
```
Obtains all valid (not yet expired) reminders set by the current application. This API uses an asynchronous callback to return the reminders. Obtains all valid (not yet expired) reminders set by the current application. This API uses an asynchronous callback to return the reminders.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.getValidReminders](js-apis-reminderAgentManager.md#reminderagentmanagergetvalidreminders).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback\<Array\<[ReminderRequest](#reminderrequest)\>\> | Yes| Asynchronous callback used to return an array of all valid reminders set by the current application.| | callback | AsyncCallback&lt;Array&lt;[ReminderRequest](#reminderrequest)&gt;&gt; | Yes| Callback used to return an array of all valid reminders set by the current application.|
**Example** **Example**
```ts ```js
reminderAgent.getValidReminders((err, reminders) => { reminderAgent.getValidReminders((err, reminders) => {
console.log("callback, getValidReminders length = " + reminders.length); console.log("callback, getValidReminders length = " + reminders.length);
for (let i = 0; i < reminders.length; i++) { for (let i = 0; i < reminders.length; i++) {
...@@ -187,25 +195,27 @@ reminderAgent.getValidReminders((err, reminders) => { ...@@ -187,25 +195,27 @@ reminderAgent.getValidReminders((err, reminders) => {
``` ```
## reminderAgent.getValidReminders ## reminderAgent.getValidReminders<sup>(deprecated)</sup>
```ts getValidReminders(): Promise\<Array\<ReminderRequest>>
getValidReminders(): Promise<Array<ReminderRequest>>
```
Obtains all valid (not yet expired) reminders set by the current application. This API uses a promise to return the reminders. Obtains all valid (not yet expired) reminders set by the current application. This API uses a promise to return the reminders.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.getValidReminders](js-apis-reminderAgentManager.md#reminderagentmanagergetvalidreminders-1).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<Array\<[ReminderRequest](#reminderrequest)\>\> | Promise used to return an array of all valid reminders set by the current application.| | Promise&lt;Array&lt;[ReminderRequest](#reminderrequest)&gt;&gt; | Promise used to return an array of all valid reminders set by the current application.|
**Example** **Example**
```ts ```js
reminderAgent.getValidReminders().then((reminders) => { reminderAgent.getValidReminders().then((reminders) => {
console.log("promise, getValidReminders length = " + reminders.length); console.log("promise, getValidReminders length = " + reminders.length);
for (let i = 0; i < reminders.length; i++) { for (let i = 0; i < reminders.length; i++) {
...@@ -233,63 +243,70 @@ reminderAgent.getValidReminders().then((reminders) => { ...@@ -233,63 +243,70 @@ reminderAgent.getValidReminders().then((reminders) => {
``` ```
## reminderAgent.cancelAllReminders ## reminderAgent.cancelAllReminders<sup>(deprecated)</sup>
```ts cancelAllReminders(callback: AsyncCallback&lt;void&gt;): void
cancelAllReminders(callback: AsyncCallback<void>): void
```
Cancels all reminders set by the current application. This API uses an asynchronous callback to return the cancellation result. Cancels all reminders set by the current application. This API uses an asynchronous callback to return the cancellation result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelAllReminders](js-apis-reminderAgentManager.md#reminderagentmanagercancelallreminders).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
```ts ```js
reminderAgent.cancelAllReminders((err, data) =>{ reminderAgent.cancelAllReminders((err, data) =>{
console.log("cancelAllReminders callback") console.log("cancelAllReminders callback")
}) })
``` ```
## reminderAgent.cancelAllReminders ## reminderAgent.cancelAllReminders<sup>(deprecated)</sup>
```ts cancelAllReminders(): Promise\<void>
cancelAllReminders(): Promise<void>
```
Cancels all reminders set by the current application. This API uses a promise to return the cancellation result. Cancels all reminders set by the current application. This API uses a promise to return the cancellation result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelAllReminders](js-apis-reminderAgentManager.md#reminderagentmanagercancelallreminders-1).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<void\> | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
```ts ```js
reminderAgent.cancelAllReminders().then(() => { reminderAgent.cancelAllReminders().then(() => {
console.log("cancelAllReminders promise") console.log("cancelAllReminders promise")
}) })
``` ```
## reminderAgent.addNotificationSlot ## reminderAgent.addNotificationSlot
```ts addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback&lt;void&gt;): void
addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback<void>): void
```
Adds a notification slot. This API uses an asynchronous callback to return the result. Adds a notification slot. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.addNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanageraddnotificationslot).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Parameters** **Parameters**
...@@ -297,11 +314,11 @@ Adds a notification slot. This API uses an asynchronous callback to return the r ...@@ -297,11 +314,11 @@ Adds a notification slot. This API uses an asynchronous callback to return the r
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.| | slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.|
| callback | AsyncCallback\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
```ts ```js
import notification from '@ohos.notification' import notification from '@ohos.notification'
let mySlot = { let mySlot = {
...@@ -313,14 +330,16 @@ reminderAgent.addNotificationSlot(mySlot, (err, data) => { ...@@ -313,14 +330,16 @@ reminderAgent.addNotificationSlot(mySlot, (err, data) => {
``` ```
## reminderAgent.addNotificationSlot ## reminderAgent.addNotificationSlot<sup>(deprecated)</sup>
```ts addNotificationSlot(slot: NotificationSlot): Promise\<void>
addNotificationSlot(slot: NotificationSlot): Promise<void>
```
Adds a notification slot. This API uses a promise to return the result. Adds a notification slot. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.addNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanageraddnotificationslot-1).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Parameters** **Parameters**
...@@ -333,11 +352,11 @@ Adds a notification slot. This API uses a promise to return the result. ...@@ -333,11 +352,11 @@ Adds a notification slot. This API uses a promise to return the result.
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<void\> | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
```ts ```js
import notification from '@ohos.notification' import notification from '@ohos.notification'
let mySlot = { let mySlot = {
...@@ -349,26 +368,28 @@ reminderAgent.addNotificationSlot(mySlot).then(() => { ...@@ -349,26 +368,28 @@ reminderAgent.addNotificationSlot(mySlot).then(() => {
``` ```
## reminderAgent.removeNotificationSlot ## reminderAgent.removeNotificationSlot<sup>(deprecated)</sup>
```ts removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback&lt;void&gt;): void
removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback<void>): void
```
Removes a notification slot of a specified type. This API uses an asynchronous callback to return the result. Removes a notification slot of a specified type. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.removeNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanagerremovenotificationslot).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the reminder notification slot to remove.| | slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the notification slot to remove.|
| callback | AsyncCallback\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
```ts ```js
import notification from '@ohos.notification' import notification from '@ohos.notification'
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, (err, data) => { reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, (err, data) => {
...@@ -377,31 +398,33 @@ reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, ...@@ -377,31 +398,33 @@ reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION,
``` ```
## reminderAgent.removeNotificationSlot ## reminderAgent.removeNotificationSlot<sup>(deprecated)</sup>
```ts removeNotificationSlot(slotType: notification.SlotType): Promise&lt;void&gt;
removeNotificationSlot(slotType: notification.SlotType): Promise<void>
```
Removes a notification slot of a specified type. This API uses a promise to return the result. Removes a notification slot of a specified type. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.removeNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanagerremovenotificationslot-1).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the reminder notification slot to remove.| | slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the notification slot to remove.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<void\> | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
```ts ```js
import notification from '@ohos.notification' import notification from '@ohos.notification'
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => { reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
...@@ -410,10 +433,14 @@ reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION). ...@@ -410,10 +433,14 @@ reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).
``` ```
## ActionButtonType ## ActionButtonType<sup>(deprecated)</sup>
Enumerates button types. Enumerates button types.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ActionButtonType](js-apis-reminderAgentManager.md#ActionButtonType).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Value| Description| | Name| Value| Description|
...@@ -422,10 +449,14 @@ Enumerates button types. ...@@ -422,10 +449,14 @@ Enumerates button types.
| ACTION_BUTTON_TYPE_SNOOZE | 1 | Button for snoozing the reminder.| | ACTION_BUTTON_TYPE_SNOOZE | 1 | Button for snoozing the reminder.|
## ReminderType ## ReminderType<sup>(deprecated)</sup>
Enumerates reminder types. Enumerates reminder types.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderType](js-apis-reminderAgentManager.md#ReminderType).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Value| Description| | Name| Value| Description|
...@@ -435,10 +466,14 @@ Enumerates reminder types. ...@@ -435,10 +466,14 @@ Enumerates reminder types.
| REMINDER_TYPE_ALARM | 2 | Alarm reminder.| | REMINDER_TYPE_ALARM | 2 | Alarm reminder.|
## ActionButton ## ActionButton<sup>(deprecated)</sup>
Defines a button displayed in the reminder notification. Defines a button displayed in the reminder notification.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ActionButton](js-apis-reminderAgentManager.md#ActionButton).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -447,34 +482,46 @@ Defines a button displayed in the reminder notification. ...@@ -447,34 +482,46 @@ Defines a button displayed in the reminder notification.
| type | [ActionButtonType](#actionbuttontype) | Yes| Button type.| | type | [ActionButtonType](#actionbuttontype) | Yes| Button type.|
## WantAgent ## WantAgent<sup>(deprecated)</sup>
Sets the package and ability that are redirected to when the reminder notification is clicked. Sets the package and ability that are redirected to when the reminder notification is clicked.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.WantAgent](js-apis-reminderAgentManager.md#WantAgent).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| pkgName | string | Yes| Name of the HAP that is redirected to when the reminder notification is clicked.| | pkgName | string | Yes| Name of the package that is redirected to when the reminder notification is clicked.|
| abilityName | string | Yes| Name of the ability that is redirected to when the reminder notification is clicked.| | abilityName | string | Yes| Name of the ability that is redirected to when the reminder notification is clicked.|
## MaxScreenWantAgent ## MaxScreenWantAgent<sup>(deprecated)</sup>
Provides the information about the target package and ability to start automatically when the reminder is displayed in full-screen mode. This API is reserved. Provides the information about the target package and ability to start automatically when the reminder is displayed in full-screen mode. This API is reserved.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.MaxScreenWantAgent](js-apis-reminderAgentManager.md#MaxScreenWantAgent).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| pkgName | string | Yes| Name of the HAP that is automatically started when the reminder arrives and the device is not in use.| | pkgName | string | Yes| Name of the package that is automatically started when the reminder arrives and the device is not in use.|
| abilityName | string | Yes| Name of the ability that is automatically started when the reminder arrives and the device is not in use.| | abilityName | string | Yes| Name of the ability that is automatically started when the reminder arrives and the device is not in use.|
## ReminderRequest ## ReminderRequest<sup>(deprecated)</sup>
Defines the reminder to publish. Defines the reminder to publish.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequest](js-apis-reminderAgentManager.md#ReminderRequest).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -494,42 +541,54 @@ Defines the reminder to publish. ...@@ -494,42 +541,54 @@ Defines the reminder to publish.
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | No| Type of the slot used by the reminder.| | slotType | [notification.SlotType](js-apis-notification.md#slottype) | No| Type of the slot used by the reminder.|
## ReminderRequestCalendar ## ReminderRequestCalendar<sup>(deprecated)</sup>
ReminderRequestCalendar extends ReminderRequest ReminderRequestCalendar extends ReminderRequest
Defines a reminder for a calendar event. Defines a reminder for a calendar event.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequestCalendar](js-apis-reminderAgentManager.md#ReminderRequestCalendar).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dateTime | [LocalDateTime](#localdatetime) | Yes| Reminder time.| | dateTime | [LocalDateTime](#localdatetime) | Yes| Reminder time.|
| repeatMonths | Array\<number\> | No| Month in which the reminder repeats.| | repeatMonths | Array&lt;number&gt; | No| Month in which the reminder repeats.|
| repeatDays | Array\<number\> | No| Date on which the reminder repeats.| | repeatDays | Array&lt;number&gt; | No| Date on which the reminder repeats.|
## ReminderRequestAlarm ## ReminderRequestAlarm<sup>(deprecated)</sup>
ReminderRequestAlarm extends ReminderRequest ReminderRequestAlarm extends ReminderRequest
Defines a reminder for an alarm. Defines a reminder for an alarm.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequestAlarm](js-apis-reminderAgentManager.md#ReminderRequestAlarm).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| hour | number | Yes| Hour portion of the reminder time.| | hour | number | Yes| Hour portion of the reminder time.|
| minute | number | Yes| Minute portion of the reminder time.| | minute | number | Yes| Minute portion of the reminder time.|
| daysOfWeek | Array\<number\> | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.| | daysOfWeek | Array&lt;number&gt; | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.|
## ReminderRequestTimer ## ReminderRequestTimer<sup>(deprecated)</sup>
ReminderRequestTimer extends ReminderRequest ReminderRequestTimer extends ReminderRequest
Defines a reminder for a scheduled timer. Defines a reminder for a scheduled timer.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequestTimer](js-apis-reminderAgentManager.md#ReminderRequestTimer).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -537,10 +596,14 @@ Defines a reminder for a scheduled timer. ...@@ -537,10 +596,14 @@ Defines a reminder for a scheduled timer.
| triggerTimeInSeconds | number | Yes| Number of seconds in the countdown timer.| | triggerTimeInSeconds | number | Yes| Number of seconds in the countdown timer.|
## LocalDateTime ## LocalDateTime<sup>(deprecated)</sup>
Sets the time information for a calendar reminder. Sets the time information for a calendar reminder.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.LocalDateTime](js-apis-reminderAgentManager.md#LocalDateTime).
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
......
...@@ -122,7 +122,7 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba ...@@ -122,7 +122,7 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| reminderId | number | Yes| ID of the reminder to cancel.| | reminderId | number | Yes| ID of the reminder to cancel.|
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Error codes** **Error codes**
...@@ -168,7 +168,7 @@ Cancels the reminder with the specified ID. This API uses a promise to return th ...@@ -168,7 +168,7 @@ Cancels the reminder with the specified ID. This API uses a promise to return th
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes** **Error codes**
...@@ -324,7 +324,7 @@ Cancels all reminders set by the current application. This API uses an asynchron ...@@ -324,7 +324,7 @@ Cancels all reminders set by the current application. This API uses an asynchron
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Error codes** **Error codes**
...@@ -401,7 +401,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r ...@@ -401,7 +401,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.| | slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -478,7 +478,7 @@ Removes a notification slot of a specified type. This API uses an asynchronous c ...@@ -478,7 +478,7 @@ Removes a notification slot of a specified type. This API uses an asynchronous c
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the notification slot to remove.| | slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the notification slot to remove.|
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -562,7 +562,7 @@ Enumerates reminder types. ...@@ -562,7 +562,7 @@ Enumerates reminder types.
## ActionButton ## ActionButton
Defines a button displayed in the reminder notification. Defines a button displayed for the reminder in the notification panel.
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
...@@ -580,8 +580,9 @@ Sets the package and ability that are redirected to when the reminder notificati ...@@ -580,8 +580,9 @@ Sets the package and ability that are redirected to when the reminder notificati
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| pkgName | string | Yes| Name of the HAP that is redirected to when the reminder notification is clicked.| | pkgName | string | Yes| Name of the target package.|
| abilityName | string | Yes| Name of the ability that is redirected to when the reminder notification is clicked.| | abilityName | string | Yes| Name of the target ability.|
| uri | string | No| URI of the target ability. (This is a system API.)|
## MaxScreenWantAgent ## MaxScreenWantAgent
...@@ -592,7 +593,7 @@ Provides the information about the target package and ability to start automatic ...@@ -592,7 +593,7 @@ Provides the information about the target package and ability to start automatic
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| pkgName | string | Yes| Name of the HAP that is automatically started when the reminder arrives and the device is not in use.| | pkgName | string | Yes| Name of the package that is automatically started when the reminder arrives and the device is not in use.|
| abilityName | string | Yes| Name of the ability that is automatically started when the reminder arrives and the device is not in use.| | abilityName | string | Yes| Name of the ability that is automatically started when the reminder arrives and the device is not in use.|
...@@ -605,8 +606,8 @@ Defines the reminder to publish. ...@@ -605,8 +606,8 @@ Defines the reminder to publish.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| reminderType | [ReminderType](#remindertype) | Yes| Type of the reminder.| | reminderType | [ReminderType](#remindertype) | Yes| Type of the reminder.|
| actionButton | [ActionButton](#actionbutton) | No| Button displayed in the reminder notification. (The parameter is optional. Up to two buttons are supported.)| | actionButton | [ActionButton](#actionbutton) | No| Button displayed for the reminder in the notification panel. (A maximum of two buttons are supported.)|
| wantAgent | [WantAgent](#wantagent) | No| Information about the ability that is redirected to when the notification is clicked.| | wantAgent | [WantAgent](#wantagent) | No| Information about the ability that is redirected to when the reminder is clicked.|
| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | No| Information about the ability that is automatically started when the reminder arrives. If the device is in use, a notification will be displayed.| | maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | No| Information about the ability that is automatically started when the reminder arrives. If the device is in use, a notification will be displayed.|
| ringDuration | number | No| Ringing duration, in seconds. The default value is **1**.| | ringDuration | number | No| Ringing duration, in seconds. The default value is **1**.|
| snoozeTimes | number | No| Number of reminder snooze times. The default value is **0**.| | snoozeTimes | number | No| Number of reminder snooze times. The default value is **0**.|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册