For the complete documentation index, see llms.txt. This page is also available as Markdown.

SDK Callbacks

SDK Lifecycle Callbacks

These callbacks can be implemented to observe SDK loading and exiting.

In order to implement these callbacks call the SDK's registerPushSDKLifecycleCallbacks method with an object literal implementing the callback(s) you need.

PushSDK.registerPushSDKLifecycleCallbacks({
  // Add function overrides here
});

The following SDK Lifecycle callbacks are available:

Finished Loading

This callback is executed when the SDK finishes its initialization and is ready for interaction.

onPushSDKDidFinishLoading(configuration, subscriberStatus) {
  // Add code to execute after SDK finishes loading
}

Exited With Subscriber Status

This callback is executed when the SDK exits and reports the subscriber's current status.

Permission Lifecycle Callbacks

These callbacks can be implemented to observe a user's permission authorization changes.

In order to implement these callbacks call the SDK's registerPermissionLifecycleCallbacks method with an object literal implementing the callback(s) you need.

The following Permission Lifecycle callbacks are available:

Permission Status Changed

This callback is executed when a user's permission status/authorization has changed.

The response variable represents the user's new permission status.

Permission Status Changed With Error

This callback is executed when a user's permission status/authorization changes and the SDK also has an error to report for that change.

error is typed as Error, but the SDK delivers an internal PushSDKException instance, which is not exported. You can read error.message, but you cannot import the class to check instanceof.

Registered For Remote Notifications

This callback is executed when the device successfully registers for remote notifications and receives a device token.

Failed To Register For Remote Notifications

This callback is executed when the device fails to register for remote notifications.

As with onPushSDKDidReceivePermissionResponseWithError, error is typed as Error but delivered as an internal, non-exported PushSDKException instance.

Notification Lifecycle Callbacks

These callbacks can be implemented to observe events like impressions, opens, and other interactions with notifications.

In order to implement these callbacks call the SDK's registerNotificationLifecycleCallbacks method with an object literal implementing the callback(s) you need.

The following Notification Lifecycle callbacks are available:

Notification Received

This callback is executed when a user receives a notification.

Notification Opened With URI/URL Destination

This callback is executed when a notification is opened that has a landing URL attached. The subscriber should be navigated to the view that represents the URL.

This method expects a Boolean response (a Promise<boolean> is also supported). If the response is true then the SDK will perform no additional actions for this notification open. If the response is false then the SDK will attempt to navigate the subscriber to the destination URL.

See the Deep Linking documentation for a complete example.

App Message Lifecycle Callbacks

These callbacks can be implemented to observe events like impressions, opens, and other interactions with app messages.

In order to implement these callbacks call the SDK's registerAppMessageLifecycleCallbacks method with an object literal implementing the callback(s) you need.

The following App Message Lifecycle callbacks are available:

App Message Will Present

This callback is executed when an App Message is presented to a user.

App Message Received User Interaction

This callback is executed when a user interacts with an App Message.

This method expects a Boolean response (a Promise<boolean> is also supported). If the response is true then the SDK will not handle the interaction or attempt to perform navigation when the interaction is an Open URL action. If the response is false then the SDK will process the interaction and, if the interaction is an Open URL action, will attempt to navigate the user to the destination URL.

Failed To Process Message

This callback is executed when the SDK fails to process an App Message.