提交 a59667d8 编写于 作者: G Gloria

Update docs against 17768+18341

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 f4fd2557
# @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.
...@@ -18,14 +18,18 @@ import reminderAgent from'@ohos.reminderAgent'; ...@@ -18,14 +18,18 @@ import reminderAgent from'@ohos.reminderAgent';
``` ```
## reminderAgent.publishReminder ## reminderAgent.publishReminder<sup>(deprecated)</sup>
```ts ```ts
publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback<number>): 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
...@@ -50,14 +54,18 @@ Publishes a reminder through the reminder agent. This API uses an asynchronous c ...@@ -50,14 +54,18 @@ Publishes a reminder through the reminder agent. This API uses an asynchronous c
``` ```
## reminderAgent.publishReminder ## reminderAgent.publishReminder<sup>(deprecated)</sup>
```ts ```ts
publishReminder(reminderReq: ReminderRequest): Promise<number> 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
...@@ -85,14 +93,18 @@ Publishes a reminder through the reminder agent. This API uses a promise to retu ...@@ -85,14 +93,18 @@ Publishes a reminder through the reminder agent. This API uses a promise to retu
``` ```
## reminderAgent.cancelReminder ## reminderAgent.cancelReminder<sup>(deprecated)</sup>
```ts ```ts
cancelReminder(reminderId: number, callback: AsyncCallback<void>): 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,7 +112,7 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba ...@@ -100,7 +112,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. 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\<void\> | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -111,14 +123,18 @@ reminderAgent.cancelReminder(1, (err, data) => { ...@@ -111,14 +123,18 @@ reminderAgent.cancelReminder(1, (err, data) => {
``` ```
## reminderAgent.cancelReminder ## reminderAgent.cancelReminder<sup>(deprecated)</sup>
```ts ```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**
...@@ -141,21 +157,25 @@ reminderAgent.cancelReminder(1).then(() => { ...@@ -141,21 +157,25 @@ reminderAgent.cancelReminder(1).then(() => {
}); });
``` ```
## reminderAgent.getValidReminders ## reminderAgent.getValidReminders<sup>(deprecated)</sup>
```ts ```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\<Array\<[ReminderRequest](#reminderrequest)\>\> | Yes| Callback used to return an array of all valid reminders set by the current application.|
**Example** **Example**
...@@ -187,14 +207,18 @@ reminderAgent.getValidReminders((err, reminders) => { ...@@ -187,14 +207,18 @@ reminderAgent.getValidReminders((err, reminders) => {
``` ```
## reminderAgent.getValidReminders ## reminderAgent.getValidReminders<sup>(deprecated)</sup>
```ts ```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**
...@@ -233,21 +257,25 @@ reminderAgent.getValidReminders().then((reminders) => { ...@@ -233,21 +257,25 @@ reminderAgent.getValidReminders().then((reminders) => {
``` ```
## reminderAgent.cancelAllReminders ## reminderAgent.cancelAllReminders<sup>(deprecated)</sup>
```ts ```ts
cancelAllReminders(callback: AsyncCallback<void>): 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\<void\> | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -258,14 +286,18 @@ reminderAgent.cancelAllReminders((err, data) =>{ ...@@ -258,14 +286,18 @@ reminderAgent.cancelAllReminders((err, data) =>{
``` ```
## reminderAgent.cancelAllReminders ## reminderAgent.cancelAllReminders<sup>(deprecated)</sup>
```ts ```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**
...@@ -282,14 +314,18 @@ reminderAgent.cancelAllReminders().then(() => { ...@@ -282,14 +314,18 @@ reminderAgent.cancelAllReminders().then(() => {
}) })
``` ```
## reminderAgent.addNotificationSlot ## reminderAgent.addNotificationSlot<sup>(deprecated)</sup>
```ts ```ts
addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback<void>): 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,7 +333,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r ...@@ -297,7 +333,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\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback\<void\> | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -313,14 +349,18 @@ reminderAgent.addNotificationSlot(mySlot, (err, data) => { ...@@ -313,14 +349,18 @@ reminderAgent.addNotificationSlot(mySlot, (err, data) => {
``` ```
## reminderAgent.addNotificationSlot ## reminderAgent.addNotificationSlot<sup>(deprecated)</sup>
```ts ```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**
...@@ -349,7 +389,7 @@ reminderAgent.addNotificationSlot(mySlot).then(() => { ...@@ -349,7 +389,7 @@ reminderAgent.addNotificationSlot(mySlot).then(() => {
``` ```
## reminderAgent.removeNotificationSlot ## reminderAgent.removeNotificationSlot<sup>(deprecated)</sup>
```ts ```ts
removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback<void>): void removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback<void>): void
...@@ -357,6 +397,10 @@ removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback< ...@@ -357,6 +397,10 @@ removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback<
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**
...@@ -364,7 +408,7 @@ Removes a notification slot of a specified type. This API uses an asynchronous c ...@@ -364,7 +408,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 reminder notification slot to remove.| | slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the reminder notification slot to remove.|
| callback | AsyncCallback\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback\<void\> | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -377,7 +421,7 @@ reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, ...@@ -377,7 +421,7 @@ reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION,
``` ```
## reminderAgent.removeNotificationSlot ## reminderAgent.removeNotificationSlot<sup>(deprecated)</sup>
```ts ```ts
removeNotificationSlot(slotType: notification.SlotType): Promise<void> removeNotificationSlot(slotType: notification.SlotType): Promise<void>
...@@ -385,6 +429,10 @@ removeNotificationSlot(slotType: notification.SlotType): Promise<void> ...@@ -385,6 +429,10 @@ 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**
...@@ -410,10 +458,14 @@ reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION). ...@@ -410,10 +458,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 +474,14 @@ Enumerates button types. ...@@ -422,10 +474,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 +491,14 @@ Enumerates reminder types. ...@@ -435,10 +491,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,10 +507,14 @@ Defines a button displayed in the reminder notification. ...@@ -447,10 +507,14 @@ 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|
...@@ -459,10 +523,14 @@ Sets the package and ability that are redirected to when the reminder notificati ...@@ -459,10 +523,14 @@ Sets the package and ability that are redirected to when the reminder notificati
| 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|
...@@ -471,10 +539,14 @@ Provides the information about the target package and ability to start automatic ...@@ -471,10 +539,14 @@ Provides the information about the target package and ability to start automatic
| 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,12 +566,16 @@ Defines the reminder to publish. ...@@ -494,12 +566,16 @@ 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|
...@@ -509,12 +585,16 @@ Defines a reminder for a calendar event. ...@@ -509,12 +585,16 @@ Defines a reminder for a calendar event.
| repeatDays | Array\<number\> | No| Date on which the reminder repeats.| | repeatDays | Array\<number\> | 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|
...@@ -524,12 +604,16 @@ Defines a reminder for an alarm. ...@@ -524,12 +604,16 @@ Defines a reminder for an alarm.
| 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\<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.|
## 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 +621,14 @@ Defines a reminder for a scheduled timer. ...@@ -537,10 +621,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|
......
...@@ -18,9 +18,7 @@ import reminderAgentManager from'@ohos.reminderAgentManager'; ...@@ -18,9 +18,7 @@ import reminderAgentManager from'@ohos.reminderAgentManager';
## reminderAgentManager.publishReminder ## reminderAgentManager.publishReminder
```ts publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>): 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).
...@@ -33,7 +31,7 @@ Publishes a reminder through the reminder agent. This API uses an asynchronous c ...@@ -33,7 +31,7 @@ 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\<number> | Yes| Callback used to return the published reminder's ID.|
**Error codes** **Error codes**
...@@ -67,9 +65,7 @@ try { ...@@ -67,9 +65,7 @@ try {
## reminderAgentManager.publishReminder ## reminderAgentManager.publishReminder
```ts publishReminder(reminderReq: ReminderRequest): Promise\<number>
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).
...@@ -85,7 +81,7 @@ Publishes a reminder through the reminder agent. This API uses a promise to retu ...@@ -85,7 +81,7 @@ 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\<number> | Promise used to return the published reminder's ID.|
**Error codes** **Error codes**
...@@ -117,9 +113,7 @@ try { ...@@ -117,9 +113,7 @@ try {
## reminderAgentManager.cancelReminder ## reminderAgentManager.cancelReminder
```ts cancelReminder(reminderId: number, callback: AsyncCallback\<void>): 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.
...@@ -130,7 +124,7 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba ...@@ -130,7 +124,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\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
**Error codes** **Error codes**
...@@ -160,9 +154,7 @@ try { ...@@ -160,9 +154,7 @@ try {
## reminderAgentManager.cancelReminder ## reminderAgentManager.cancelReminder
```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.
...@@ -178,7 +170,7 @@ Cancels the reminder with the specified ID. This API uses a promise to return th ...@@ -178,7 +170,7 @@ 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.| | PPromise\<void> | Promise used to return the result.|
**Error codes** **Error codes**
...@@ -205,10 +197,8 @@ try { ...@@ -205,10 +197,8 @@ try {
## reminderAgentManager.getValidReminders ## reminderAgentManager.getValidReminders
```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.
...@@ -218,7 +208,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th ...@@ -218,7 +208,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
| 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\<Array\<[ReminderRequest](#reminderrequest)>> | Yes| Asynchronous callback used to return an array of all valid reminders set by the current application.|
**Error codes** **Error codes**
...@@ -267,9 +257,7 @@ try { ...@@ -267,9 +257,7 @@ try {
## reminderAgentManager.getValidReminders ## reminderAgentManager.getValidReminders
```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.
...@@ -279,7 +267,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th ...@@ -279,7 +267,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<Array\<[ReminderRequest](#reminderrequest)\>\> | Promise used to return an array of all valid reminders set by the current application.| | Promise\<Array\<[ReminderRequest](#reminderrequest)>> | Promise used to return an array of all valid reminders set by the current application.|
**Error codes** **Error codes**
...@@ -327,9 +315,7 @@ try { ...@@ -327,9 +315,7 @@ try {
## reminderAgentManager.cancelAllReminders ## reminderAgentManager.cancelAllReminders
```ts cancelAllReminders(callback: AsyncCallback\<void>): 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.
...@@ -339,7 +325,7 @@ Cancels all reminders set by the current application. This API uses an asynchron ...@@ -339,7 +325,7 @@ Cancels all reminders set by the current application. This API uses an asynchron
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
**Error codes** **Error codes**
...@@ -368,9 +354,7 @@ try { ...@@ -368,9 +354,7 @@ try {
## reminderAgentManager.cancelAllReminders ## reminderAgentManager.cancelAllReminders
```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.
...@@ -380,7 +364,7 @@ Cancels all reminders set by the current application. This API uses a promise to ...@@ -380,7 +364,7 @@ Cancels all reminders set by the current application. This API uses a promise to
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes** **Error codes**
...@@ -407,9 +391,7 @@ try { ...@@ -407,9 +391,7 @@ try {
## reminderAgentManager.addNotificationSlot ## reminderAgentManager.addNotificationSlot
```ts addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): 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.
...@@ -420,7 +402,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r ...@@ -420,7 +402,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\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -446,9 +428,7 @@ try { ...@@ -446,9 +428,7 @@ try {
## reminderAgentManager.addNotificationSlot ## reminderAgentManager.addNotificationSlot
```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.
...@@ -464,7 +444,7 @@ Adds a notification slot. This API uses a promise to return the result. ...@@ -464,7 +444,7 @@ 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\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -488,9 +468,7 @@ try { ...@@ -488,9 +468,7 @@ try {
## reminderAgentManager.removeNotificationSlot ## reminderAgentManager.removeNotificationSlot
```ts removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\<void>): 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.
...@@ -501,7 +479,7 @@ Removes a notification slot of a specified type. This API uses an asynchronous c ...@@ -501,7 +479,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\<void\> | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -524,9 +502,7 @@ try { ...@@ -524,9 +502,7 @@ try {
## reminderAgentManager.removeNotificationSlot ## reminderAgentManager.removeNotificationSlot
```ts removeNotificationSlot(slotType: notification.SlotType): Promise\<void>
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.
...@@ -542,7 +518,7 @@ Removes a notification slot of a specified type. This API uses a promise to retu ...@@ -542,7 +518,7 @@ Removes a notification slot of a specified type. This API uses a promise to retu
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -570,7 +546,7 @@ Enumerates button types. ...@@ -570,7 +546,7 @@ Enumerates button types.
| -------- | -------- | -------- | | -------- | -------- | -------- |
| ACTION_BUTTON_TYPE_CLOSE | 0 | Button for closing the reminder.| | ACTION_BUTTON_TYPE_CLOSE | 0 | Button for closing the reminder.|
| ACTION_BUTTON_TYPE_SNOOZE | 1 | Button for snoozing the reminder.| | ACTION_BUTTON_TYPE_SNOOZE | 1 | Button for snoozing the reminder.|
| ACTION_BUTTON_TYPE_CUSTOM<sup>10+</sup> | 2 | Custom button. (This is a system API.)| | ACTION_BUTTON_TYPE_CUSTOM<sup>10+</sup> | 2 | Custom button.<br>**System API**: This is a system API and cannot be called by third-party applications.|
## ReminderType ## ReminderType
...@@ -590,13 +566,14 @@ Enumerates reminder types. ...@@ -590,13 +566,14 @@ Enumerates reminder types.
Defines a button displayed for the reminder in the notification panel. Defines a button displayed for the reminder in the notification panel.
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| title | string | Yes| Text on the button.| | title | string | Yes| Text on the button.|
| type | [ActionButtonType](#actionbuttontype) | Yes| Button type.| | type | [ActionButtonType](#actionbuttontype) | Yes| Button type.|
| wantAgent<sup>10+</sup> | [WantAgent](#wantagent) | No| Ability information that is displayed after the button is clicked. (This is a system API.)| | wantAgent<sup>10+</sup> | [WantAgent](#wantagent) | No| Ability information that is displayed after the button is clicked.<br>**System API**: This is a system API and cannot be called by third-party applications.|
## WantAgent ## WantAgent
...@@ -605,10 +582,12 @@ Defines the information about the redirected-to ability. ...@@ -605,10 +582,12 @@ Defines the information about the redirected-to ability.
**System capability**: SystemCapability.Notification.ReminderAgent **System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| pkgName | string | Yes| Name of the target package.| | pkgName | string | Yes| Name of the target package.|
| abilityName | string | Yes| Name of the target ability.| | abilityName | string | Yes| Name of the target ability.|
| uri<sup>10+</sup> | string | No| URI of the target ability.<br>**System API**: This is a system API and cannot be called by third-party applications.|
## MaxScreenWantAgent ## MaxScreenWantAgent
...@@ -632,7 +611,7 @@ Defines the reminder to publish. ...@@ -632,7 +611,7 @@ 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 for the reminder in the notification panel. For common applications, a maximum of two buttons are supported. For system applications, a maximum of two buttons are supported in API version 9, and a maximum of three buttons are supported in API version 10 and later versions. | | actionButton<sup>10+</sup> | [ActionButton](#actionbutton) | No| Button displayed for the reminder in the notification panel. For common applications, a maximum of two buttons are supported. For system applications, a maximum of two buttons are supported in API version 9, and a maximum of three buttons are supported in API version 10 and later versions. |
| wantAgent | [WantAgent](#wantagent) | No| Information about the ability that is redirected to when the reminder 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**.|
...@@ -659,8 +638,8 @@ Defines a reminder for a calendar event. ...@@ -659,8 +638,8 @@ Defines a reminder for a calendar event.
| 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\<number> | No| Month in which the reminder repeats.|
| repeatDays | Array\<number\> | No| Date on which the reminder repeats.| | repeatDays | Array\<number> | No| Date on which the reminder repeats.|
## ReminderRequestAlarm ## ReminderRequestAlarm
...@@ -675,7 +654,7 @@ Defines a reminder for an alarm. ...@@ -675,7 +654,7 @@ Defines a reminder for an alarm.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| 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\<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.|
## ReminderRequestTimer ## ReminderRequestTimer
......
# Resource Scheduler Subsystem Changelog
## cl.resourceschedule.reminderAgent.1
The reminder agent allows you to customize buttons for system applications. Clicking a custom button will redirect you to the specified application page.
**Change Impact**
For system applications developed based on OpenHarmony 4.0.7.1 and later SDK versions, you can set custom buttons for reminders.
**Key API/Component Changes**
| Module| Class| Method/Attribute/Enum/Constant| Change Type|
| -- | -- | -- | -- |
| reminderAgentManager | ActionButtonType | ACTION_BUTTON_TYPE_CUSTOM = 2 | Added|
| reminderAgentManager | ActionButton | wantAgent?: WantAgent | Added|
| reminderAgentManager | WantAgent | uri?: string | Added|
| reminderAgentManager | ReminderRequest | actionButton?: [ActionButton?, ActionButton?, ActionButton?] | Changed|
**Adaptation Guide**
```ts
import reminderAgentManager from '@ohos.reminderAgentManager';
let targetReminderAgent: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM, // The reminder type is alarm clock.
...
actionButton: [
{
title: 'Remind later',
type: reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_SNOOZE
},
{
title: 'Close',
type: reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE
},
{
title: 'Custom',
type: reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_CUSTOM,
wantAgent: {
pkgName: "com.example.myapplication",
abilityName: "EntryAbility",
}
},
]
}
```
## cl.resourceschedule.reminderAgent.2
The reminder agent allows you to set reminders to automatically disappear at the given time.
**Change Impact**
For system applications developed based on OpenHarmony 4.0.7.1 and later SDK versions, you can set the reminders to disappear automatically.
**Key API/Component Changes**
| Module| Class| Method/Attribute/Enum/Constant| Change Type|
| -- | -- | -- | -- |
| reminderAgentManager | ReminderRequest | tapDismissed?: boolean | Added|
| reminderAgentManager | ReminderRequest | autoDeletedTime?: number | Added|
**Adaptation Guide**
```ts
import reminderAgentManager from '@ohos.reminderAgentManager';
let targetReminderAgent: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM, // The reminder type is alarm clock.
...
tapDismissed: true,
autoDeletedTime: 300,
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册