0.0.1 • Published 1 year ago

capacitor-notify-persistent v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

capacitor-notify-persistent

Notification Persistent

Install

npm install capacitor-notify-persistent
npx cap sync

API

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.

ParamTypeDescription
eventName'notificationActionPerformed'O nome do evento ('notificationActionPerformed' ou 'notificationAction').
listenerFunc(notification: any) => voidA 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.

ParamTypeDescription
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
ParamType
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.

ParamType
eventName'tokenReceived'
listenerFuncTokenReceivedListener

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>
ParamType
optionsGetTokenOptions

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

PropType
remove() => Promise<void>

TokenReceivedEvent

PropTypeSince
tokenstring0.2.2

PermissionStatus

PropTypeSince
receivePermissionState0.2.2

GetTokenResult

PropTypeSince
tokenstring0.2.2

GetTokenOptions

PropTypeDescription
vapidKeystringYour VAPID public key, which is required to retrieve the current registration token on the web. Only available for Web.
serviceWorkerRegistrationServiceWorkerRegistrationThe 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'

0.0.1

1 year ago