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

MethodModifiersDescription
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

ParameterTypeDescription
identifierstringThe 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

ParameterTypeDescription
titlestringThe title of the notification
bodystringThe body of the notification
scheduledTimeDateThe 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.