capacitor-notify-persistent v0.0.1
capacitor-notify-persistent
Notification Persistent
Install
npm install capacitor-notify-persistent
npx cap sync
API
stopContinuousVibration()
enablePlugin()
disablePlugin()
isEnabled()
addListener('notificationActionPerformed', ...)
addListener('notificationLocalActionPerformed', ...)
addListener('notificationReceived', ...)
addListener('tokenReceived', ...)
removeAllListeners()
checkPermissions()
requestPermissions()
getToken(...)
deleteToken()
- Interfaces
- Type Aliases
Interface para gerenciar o plugin de notificações persistentes.
stopContinuousVibration()
stopContinuousVibration() => Promise<{ value: boolean; }>
Interrompe a vibração contínua.
Returns: Promise<{ value: boolean; }>
enablePlugin()
enablePlugin() => Promise<void>
Habilita o plugin.
disablePlugin()
disablePlugin() => Promise<void>
Desabilita o plugin.
isEnabled()
isEnabled() => Promise<{ value: boolean; }>
Verifica se o plugin está habilitado.
Returns: Promise<{ value: boolean; }>
addListener('notificationActionPerformed', ...)
addListener(eventName: 'notificationActionPerformed', listenerFunc: (notification: any) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Adiciona um listener para o evento de notificação recebida.
Param | Type | Description |
---|---|---|
eventName | 'notificationActionPerformed' | O nome do evento ('notificationActionPerformed' ou 'notificationAction'). |
listenerFunc | (notification: any) => void | A função que será chamada quando o evento ocorrer. |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener('notificationLocalActionPerformed', ...)
addListener(eventName: 'notificationLocalActionPerformed', listenerFunc: (action: any) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Adds a listener for the notification action event.
Param | Type | Description |
---|---|---|
eventName | 'notificationLocalActionPerformed' | - The name of the event ('notificationLocalActionPerformed' or 'notificationAction'). |
listenerFunc | (action: any) => void | - The function that will be called when the event occurs. |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.2.2
addListener('notificationReceived', ...)
addListener(eventName: 'notificationReceived', listenerFunc: (action: any) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName | 'notificationReceived' |
listenerFunc | (action: any) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener('tokenReceived', ...)
addListener(eventName: 'tokenReceived', listenerFunc: TokenReceivedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when a new FCM token is received.
Only available for Android and iOS.
Param | Type |
---|---|
eventName | 'tokenReceived' |
listenerFunc | TokenReceivedListener |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.2.2
removeAllListeners()
removeAllListeners() => Promise<void>
checkPermissions()
checkPermissions() => Promise<PermissionStatus>
Check permission to receive push notifications.
On Android, this method only needs to be called on Android 13+.
Returns: Promise<PermissionStatus>
Since: 0.2.2
requestPermissions()
requestPermissions() => Promise<PermissionStatus>
Request permission to receive push notifications.
On Android, this method only needs to be called on Android 13+.
Returns: Promise<PermissionStatus>
Since: 0.2.2
getToken(...)
getToken(options?: GetTokenOptions | undefined) => Promise<GetTokenResult>
Param | Type |
---|---|
options | GetTokenOptions |
Returns: Promise<GetTokenResult>
deleteToken()
deleteToken() => Promise<void>
Delete the FCM token and unregister the app to stop receiving push notifications. Can be called, for example, when a user signs out.
Since: 0.2.2
Interfaces
PluginListenerHandle
Prop | Type |
---|---|
remove | () => Promise<void> |
TokenReceivedEvent
Prop | Type | Since |
---|---|---|
token | string | 0.2.2 |
PermissionStatus
Prop | Type | Since |
---|---|---|
receive | PermissionState | 0.2.2 |
GetTokenResult
Prop | Type | Since |
---|---|---|
token | string | 0.2.2 |
GetTokenOptions
Prop | Type | Description |
---|---|---|
vapidKey | string | Your VAPID public key, which is required to retrieve the current registration token on the web. Only available for Web. |
serviceWorkerRegistration | ServiceWorkerRegistration | The service worker registration for receiving push messaging. If the registration is not provided explicitly, you need to have a firebase-messaging-sw.js at your root location. Only available for Web. |
Type Aliases
TokenReceivedListener
Callback to receive the token received event.
(event: TokenReceivedEvent): void
PermissionState
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
1 year ago