Advanced
The following guides cover advanced features and customization options available in the Actito SDK.
These topics are optional and can be adopted selectively based on your application’s requirements. You can safely skip any sections that are not relevant to your use case or implementation strategy.
Receiving Push Events
When using the Remote Notifications module, you can listen to a series of push events emitted by the SDK during notification delivery and interaction lifecycle.
These events allow you to extend the default behavior — for example, tracking delivery analytics, responding to user interactions, or handling custom payloads.
Push Events
onSubscriptionChanged: Called when the device's push subscription changes.
import { onSubscriptionChanged } from 'actito-web/push';
onSubscriptionChanged((subscription) => {
console.log('Subscription changed: ', subscription);
});
onNotificationSettingsChanged: Called when the notification settings are changed.
import { onNotificationSettingsChanged } from 'actito-web/push';
onNotificationSettingsChanged((allowedUI) => {
console.log('Notification settings changed: ', allowedUI);
});
onNotificationReceived: Called when a push notification is received.
import { onNotificationReceived } from 'actito-web/push';
onNotificationReceived((notification) => {
console.log('Notification received: ', notification);
});
onUnknownNotificationReceived: Called when an unknown type of notification is received.
import { onUnknownNotificationReceived } from 'actito-web/push';
onUnknownNotificationReceived((notification) => {
console.log('Unknown notification received: ', notification);
});
onSystemNotificationReceived: Called when a custom system notification is received.
import { onSystemNotificationReceived } from 'actito-web/push';
onSystemNotificationReceived((notification) => {
console.log('System notification received: ', notification);
});
onNotificationOpened: Called when a push notification is opened by the user.
import { onNotificationOpened } from 'actito-web/push';
onNotificationOpened((notification) => {
console.log('Notification opened: ', notification);
});
onNotificationActionOpened: Called when a push notification action is opened by the user.
import { onNotificationActionOpened } from 'actito-web/push';
onNotificationActionOpened((notification, action) => {
console.log('Action opened: ', notification, action);
});
Notification lifecycle
When using the Push UI module to present notifications and actions, you can listen to a series of lifecycle events emitted during the notification presentation process. In more advanced implementations, these events can be leveraged to execute additional logic — such as tracking analytics, updating application state, or triggering custom navigation behaviors.
Notification Presentation Events
These methods notify you of each stage in a notification’s presentation lifecycle:
onNotificationWillPresent: Called immediately before the notification is displayed.
import { onNotificationWillPresent } from 'actito-web/push-ui';
onNotificationWillPresent((notification) => {
console.log(`About to present notification: ${notification.id}`);
});
onNotificationPresented: Called right after the notification is presented.
import { onNotificationPresented } from 'actito-web/push-ui';
onNotificationPresented((notification) => {
console.log(`Presented notification: ${notification.id}`);
});
onNotificationFinishedPresenting: Called when the notification UI has been dismissed or closed.
import { onNotificationFinishedPresenting } from 'actito-web/push-ui';
onNotificationFinishedPresenting((notification) => {
console.log(`Notification finished presenting: ${notification.id}`);
});
onNotificationFailedToPresent: Called if an error occurs during presentation.
import { onNotificationFailedToPresent } from 'actito-web/push-ui';
onNotificationFailedToPresent((notification) => {
console.log(`Failed to present notification: ${notification.id}`);
});
Action Execution Events
These methods notify you of each stage in an action’s execution lifecycle:
onActionWillExecute: Called just before an action is performed.
import { onActionWillExecute } from 'actito-web/push-ui';
onActionWillExecute((notification, action) => {
console.log(`Preparing to execute action: ${action.label}`);
});
onActionExecuted: Called when the action has been successfully performed.
import { onActionExecuted } from 'actito-web/push-ui';
onActionExecuted((notification, action) => {
console.log(`Executed action: ${action.label}`);
});
onActionFailedToExecute: Called when the SDK attempted to execute the action but encountered an error.
import { onActionFailedToExecute } from 'actito-web/push-ui';
onActionFailedToExecute((notification, action) => {
console.log(`Action failed to execute: ${action.label}`);
});
onCustomActionReceived: Gives you an opportunity to intercept and decide how to handle a custom action.
import { onCustomActionReceived } from 'actito-web/push-ui';
onCustomActionReceived((notification, action, target) => {
console.log(`Received a custom action to execute: ${action.label}`);
});