capacitor-notifications-alarm
v0.1.4
Published
Alarm notifications plugin for ionic capacitor
Readme
capacitor-notifications-alarm
Alarm notifications plugin for ionic capacitor
Install
npm install capacitor-notifications-alarm
npx cap syncAPI
checkNotificationsPermissions()requestNotificationsPermissions()getScheduledNotifications()scheduleNotification(...)removeScheduledNotification(...)removeAllScheduledNotifications()addListener('notificationReceived', ...)addListener('notificationActionPerformed', ...)- Interfaces
- Type Aliases
checkNotificationsPermissions()
checkNotificationsPermissions() => Promise<permissionStatus>Check notifications permission
Returns: Promise<permissionStatus>
requestNotificationsPermissions()
requestNotificationsPermissions() => Promise<permissionStatus>Request notificationPermission
Returns: Promise<permissionStatus>
getScheduledNotifications()
getScheduledNotifications() => Promise<{ scheduledNotifications: any[]; }>Get scheduled notifications
Returns: Promise<{ scheduledNotifications: any[]; }>
scheduleNotification(...)
scheduleNotification(options: NotificationScheduleType) => Promise<any>Schedule notifications
| Param | Type |
| ------------- | ----------------------------------------------------------------------------- |
| options | NotificationScheduleType |
Returns: Promise<any>
removeScheduledNotification(...)
removeScheduledNotification(options: { id: number; }) => Promise<{ status: 'removed' | 'error'; }>Remove scheduled notification by id
| Param | Type |
| ------------- | ---------------------------- |
| options | { id: number; } |
Returns: Promise<{ status: 'error' | 'removed'; }>
removeAllScheduledNotifications()
removeAllScheduledNotifications() => Promise<{ status: 'removed' | 'error'; }>Remove all scheduled notifications
Returns: Promise<{ status: 'error' | 'removed'; }>
addListener('notificationReceived', ...)
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('notificationActionPerformed', ...)
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>
Interfaces
permissionStatus
| Prop | Type |
| ------------ | ----------------------------------------------------------- |
| status | PermissionState |
NotificationScheduleType
| Prop | Type |
| ---------------- | -------------------- |
| title | string |
| body | string |
| hour | number |
| minutes | number |
| frequency | number |
| reschedule | boolean |
| id | number |
| total | number |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
ActionPerformed
| Prop | Type |
| ------------------ | ------------------------------------------------------- |
| actionId | string |
| notification | { treatment_id: number; content: string; } |
Type Aliases
PermissionState
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
