LocalNotificationService class
Allows scheduling local notifications.
Signature:
export declare class LocalNotificationService extends ExternalObject
Extends: ExternalObject
Remarks
Use Runtime.getLocalNotificationService() to get an instance of this class.
Methods
Method | Modifiers | Description |
---|---|---|
cancelNotification(identifier) | Cancels a scheduled notification. | |
scheduleNotification(title, body, scheduledTime) | Schedules a local notification to be sent to the user at the given time. |
LocalNotificationService.cancelNotification() method
Cancels a scheduled notification.
Signature:
cancelNotification(identifier: string): void;
Parameters
Parameter | Type | Description |
---|---|---|
identifier | string | The identifier of the notification to cancel |
Returns:
void
LocalNotificationService.scheduleNotification() method
Schedules a local notification to be sent to the user at the given time.
Signature:
scheduleNotification(title: string, body: string, scheduledTime: Date): Promise<string>;
Parameters
Parameter | Type | Description |
---|---|---|
title | string | The title of the notification |
body | string | The body of the notification |
scheduledTime | Date | The time at which the notification should be sent |
Returns:
Promise<string>
A promise that resolves to the identifier of the scheduled notification
Remarks
If the notification fails to schedule, whether due to an invalid time or permissions not being granted, the identifier returned will be null.
Updated 7 months ago