Alarm notifications plugin for ionic capacitor
npm install capacitor-notifications-alarm
npx cap sync
checkNotificationsPermissions()
requestNotificationsPermissions()
getScheduledNotifications()
scheduleNotification(...)
removeScheduledNotification(...)
removeAllScheduledNotifications()
addListener('notificationReceived', ...)
addListener('notificationActionPerformed', ...)
- Interfaces
- Type Aliases
checkNotificationsPermissions() => Promise<permissionStatus>
Check notifications permission
Returns: Promise<permissionStatus>
requestNotificationsPermissions() => Promise<permissionStatus>
Request notificationPermission
Returns: Promise<permissionStatus>
getScheduledNotifications() => Promise<{ scheduledNotifications: any[]; }>
Get scheduled notifications
Returns: Promise<{ scheduledNotifications: any[]; }>
scheduleNotification(options: NotificationScheduleType) => Promise<any>
Schedule notifications
Param | Type |
---|---|
options |
NotificationScheduleType |
Returns: Promise<any>
removeScheduledNotification(options: { id: number; }) => Promise<{ status: 'removed' | 'error'; }>
Remove scheduled notification by id
Param | Type |
---|---|
options |
{ id: number; } |
Returns: Promise<{ status: 'error' | 'removed'; }>
removeAllScheduledNotifications() => Promise<{ status: 'removed' | 'error'; }>
Remove all scheduled notifications
Returns: Promise<{ status: 'error' | 'removed'; }>
addListener(eventName: 'notificationReceived', listenerFunc: (notification: { treatment_id: number; content: string; }) => void) => Promise<PluginListenerHandle>
Listener fired when user receive foreground notification
Param | Type |
---|---|
eventName |
'notificationReceived' |
listenerFunc |
(notification: { treatment_id: number; content: string; }) => void |
Returns: Promise<PluginListenerHandle>
addListener(eventName: 'notificationActionPerformed', listenerFunc: (notificationAction: ActionPerformed) => void) => Promise<PluginListenerHandle>
Listener fired when user receive background or killed app notification
Param | Type |
---|---|
eventName |
'notificationActionPerformed' |
listenerFunc |
(notificationAction: ActionPerformed) => void |
Returns: Promise<PluginListenerHandle>
Prop | Type |
---|---|
status |
PermissionState |
Prop | Type |
---|---|
title |
string |
body |
string |
hour |
number |
minutes |
number |
frequency |
number |
reschedule |
boolean |
id |
number |
total |
number |
Prop | Type |
---|---|
remove |
() => Promise<void> |
Prop | Type |
---|---|
actionId |
string |
notification |
{ treatment_id: number; content: string; } |
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'