# Development Guidelines ## When to Use You can set your application to call the **ReminderRequest** class to create scheduled reminders for countdown timers, calendar events, and alarm clocks. When the created reminders are published, the timing and pop-up notification functions of your application will be taken over by the reminder agent in the background, even when your application is frozen or exits. ## Available APIs **reminderAgent** encapsulates the methods for publishing and canceling reminders. **Table 1** Major APIs in reminderAgent
function publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback<number>): void; function publishReminder(reminderReq: ReminderRequest): Promise<number>; |
Publishes a scheduled reminder. The maximum number of valid notifications (excluding expired ones that will not pop up again) is 30 for one application and 2000 for the entire system. |
function cancelReminder(reminderId: number, callback: AsyncCallback<void>): void; |
Cancels a specified reminder. (The value of reminderId is obtained from the return value of publishReminder.) |
function getValidReminders(callback: AsyncCallback<Array<ReminderRequest>>): void; function getValidReminders(): Promise<Array<ReminderRequest>>; |
|
function cancelAllReminders(callback: AsyncCallback<void>): void; |
|
function addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback<void>): void; function addNotificationSlot(slot: NotificationSlot): Promise<void>; |
Registers a NotificationSlot instance to be used by the reminder. |
function removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback<void>): void; function removeNotificationSlot(slotType: notification.SlotType): Promise<void>; |
Removes a NotificationSlot instance of a specified type. |
Close button, which can be tapped to stop the reminder alert tone, close the reminder notification, and cancel the reminder snoozing. |
Name of the package redirected to when the reminder notification is clicked. |
|||
Name of the ability redirected to when the reminder notification is clicked. |
[ActionButton?, ActionButton?] |
|||
Information about the ability that is redirected to when the notification is clicked. |
|||
Information about the ability that is automatically started when the reminder arrives. If the device is in use, a notification will be displayed. |
|||
Extended content to be displayed when the reminder is snoozing. |
|||
Notification ID used by the reminder. For details, see the API reference of the NotificationRequest.setNotificationId(int id) method. |
|||