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

!2778 2581 处理完成:后台代理提醒-权限描述下层到函数级别

Merge pull request !2778 from ester.zhou/TR-2581
......@@ -11,30 +11,28 @@ import reminderAgent from'@ohos.reminderAgent';
```
## Required Permissions
ohos.permission.PUBLISH_AGENT_REMINDER
## reminderAgent.publishReminder
publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback<number>): void
Publishes an agent-powered reminder. This API uses an asynchronous callback to return the result.
- System capability
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER
SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
| callback | AsyncCallback<number> | Yes| Asynchronous callback used to return the published reminder's ID.|
- Example
**Example**
```
export default { data: {timer: {
export default {
data: {
timer: {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 3
}
......@@ -53,23 +51,23 @@ publishReminder(reminderReq: ReminderRequest): Promise<number>
Publishes an agent-powered reminder. This API uses a promise callback to return the result.
- System capability
SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
- Parameters
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the published reminder's ID.|
- Example
**Example**
```
export default { data: {timer: {
export default {
data:
{timer: {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 3
}
......@@ -89,22 +87,21 @@ 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.
- System capability
**System capability**: SystemCapability.Notification.ReminderAgent
SystemCapability.Notification.ReminderAgent
- Parameters
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderId | number | Yes| ID of the reminder to cancel.|
| callback | AsyncCallback<void> | Yes| Asynchronous callback used to return the result.|
- Example
**Example**
```
export default {
cancel() { reminderAgent.cancelReminder(1, (err, data) => {
cancel() {
reminderAgent.cancelReminder(1, (err, data) => {
console.log("do next");
});
}
......@@ -118,23 +115,21 @@ cancelReminder(reminderId: number): Promise<void>
Cancels the reminder with the specified ID. This API uses a promise to return the cancellation result.
- System capability
**System capability**: SystemCapability.Notification.ReminderAgent
SystemCapability.Notification.ReminderAgent
- Parameters
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderId | number | Yes| ID of the reminder to cancel.|
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<void> | Promise used to return the result.|
- Example
**Example**
```
export default {
......@@ -153,17 +148,15 @@ getValidReminders(callback: AsyncCallback<Array<ReminderRequest>>):
Obtains all valid (not yet expired) reminders set by the current application. This API uses an asynchronous callback to return the reminders.
- System capability
SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
- Parameters
**Parameters**
| 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.|
- Example
**Example**
```
reminderAgent.getValidReminders((err, reminders) => {
......@@ -198,20 +191,18 @@ 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.
- System capability
**System capability**: SystemCapability.Notification.ReminderAgent
SystemCapability.Notification.ReminderAgent
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<Array<[ReminderRequest](#reminderrequest)>> | Promise used to return an array of all valid reminders set by the current application.|
- Example
**Example**
```
reminderAgent.getValidReminders().then((reminders) => {
reminderAgent.getValidReminders().then((reminders) => {
for (let i = 0; i < reminders.length; i++) {
console.log("getValidReminders = " + reminders[i]);
console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
......@@ -243,20 +234,18 @@ cancelAllReminders(callback: AsyncCallback&lt;void&gt;): void
Cancels all reminders set by the current application. This API uses an asynchronous callback to return the cancellation result.
- System capability
SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
- Parameters
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.|
- Example
**Example**
```
reminderAgent.cancelAllReminders((err, data) =>{
reminderAgent.cancelAllReminders((err, data) =>{
console.log("do next")})
```
......@@ -267,17 +256,15 @@ cancelAllReminders(): Promise&lt;void&gt;
Cancels all reminders set by the current application. This API uses a promise to return the cancellation result.
- System capability
**System capability**: SystemCapability.Notification.ReminderAgent
SystemCapability.Notification.ReminderAgent
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
- Example
**Example**
```
reminderAgent.cancelAllReminders().then(() => {
......@@ -291,18 +278,16 @@ addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback&lt;void&gt;)
Adds a reminder notification slot. This API uses an asynchronous callback to return the result.
- System capability
SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
- Parameters
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Reminder notification slot to add.|
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.|
- Example
**Example**
```
export default { data: { mySlot: {
......@@ -324,23 +309,21 @@ addNotificationSlot(slot: NotificationSlot): Promise&lt;void&gt;
Adds a reminder notification slot. This API uses a promise to return the result.
- System capability
**System capability**: SystemCapability.Notification.ReminderAgent
SystemCapability.Notification.ReminderAgent
- Parameters
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Reminder notification slot to add.|
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
- Example
**Example**
```
export default { data: { mySlot: {
......@@ -362,18 +345,16 @@ removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback&
Removes a notification slot of a specified type. This API uses an asynchronous callback to return the result.
- System capability
SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
- Parameters
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the reminder notification slot to remove.|
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.|
- Example
**Example**
```
export default {
......@@ -391,23 +372,21 @@ removeNotificationSlot(slotType: notification.SlotType): Promise&lt;void&gt;
Removes a notification slot of a specified type. This API uses a promise to return the result.
- System capability
**System capability**: SystemCapability.Notification.ReminderAgent
SystemCapability.Notification.ReminderAgent
- Parameters
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the reminder notification slot to remove.|
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
- Example
**Example**
```
export default {
......@@ -423,7 +402,7 @@ export default {
Enumerates button types.
- **System capability**: SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Default Value| Description|
| -------- | -------- | -------- |
......@@ -435,7 +414,7 @@ Enumerates button types.
Enumerates reminder types.
- **System capability**: SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Default Value| Description|
| -------- | -------- | -------- |
......@@ -448,7 +427,7 @@ Enumerates reminder types.
Defines a button displayed in the reminder notification.
- **System capability**: SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -460,7 +439,7 @@ Defines a button displayed in the reminder notification.
Sets the package and ability that are redirected to when the reminder notification is clicked.
- **System capability**: SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -472,7 +451,7 @@ Sets the package and ability that are redirected to when the reminder notificati
Sets the name of the target package and ability to start automatically when the reminder arrives and the device is not in use. If the device is in use, a notification will be displayed.
- **System capability**: SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -484,7 +463,7 @@ Sets the name of the target package and ability to start automatically when the
Defines the reminder to publish.
- **System capability**: SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -509,7 +488,7 @@ ReminderRequestCalendar extends ReminderRequest
Defines a reminder for a calendar event.
- **System capability**: SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -524,9 +503,9 @@ ReminderRequestAlarm extends ReminderRequest
Defines a reminder for an alarm.
- **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.|
| minute | number | Yes| Minute portion of the reminder time.|
......@@ -539,7 +518,7 @@ ReminderRequestTimer extends ReminderRequest
Defines a reminder for a scheduled timer.
- **System capability**: SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -550,7 +529,7 @@ Defines a reminder for a scheduled timer.
Sets the time information for a calendar reminder.
- **System capability**: SystemCapability.Notification.ReminderAgent
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册