PushMessaging

Handles the core push messaging functionality.

The PushMessaging interface defines the contract for the push messaging module in the WebexConnect SDK. It includes properties and methods for managing push notifications, such as handling push tokens, processing push data, and managing notification permissions. The interface also provides methods for registering and unregistering listeners for push messages and tokens, as well as updating the status of messages.

This singleton is the main interface to the Webex Connect messaging system, it provides methods that facilitate incoming and outgoing messages, thread and topic management, message status, and connection control.

Interface for push messaging module.

Syntax: interface PushMessaging : ConnectModule

Types

NameType
Companionobject Companion

Companin Properties

NameTypeDescription
instancePushMessagingThe singleton instance of PushMessaging.

Properties

NameTypeDescription
actionHandlerNotificationActionHandlerThis property represents the handler for notification actions. This can be set to different implementations of the NotificationActionHandler interface, which handles user interactions with notifications.
inAppNotificationManagerInAppNotificationManagerThe in-app notification manager for handling banner and modal inApp Notifications.
notificationFactoryNotificationFactoryFactory for creating notifications. This can be set to different implementations of the NotificationFactory interface, which is responsible for creating notification objects based on the received push messages.
priorityIntThe priority of the module. Higher-priority modules are started before lower-priority modules.
providerPushProviderThis property represents the provider of push notifications. This can be set to different implementations of the PushProvider interface, which handles the registration and management of push notifications.
pushTokenStringThis property holds the token for the push notification service. This token is used to uniquely identify the device for receiving push notifications.

Functions

Function NameDescription
isConnectMessageDataThis helper method returns whether the message is from the Webex Connectplatform or not.
processMessageDataProcesses received message data.
processTokenProcesses received token.
registerMessagingListenerRegisters a listener for new push messages.
registerTokenListenerRegisters a listener for a new push token.
requestNotificationPermissionRequests the system notification permission prompt to enable notifications display on Android 13 devices. This permission is required for apps that target Android API level 33 to allow an app to post notifications.
sendMessageStatusUpdates the status of one or more messages.
Sends the status of a message.
shutdownPerforms the shutdown operations for the Push Messaging module.
startupPerforms the startup operations for the Push Messaging module.
unregisterMessagingListenerUnregister a previously registered listener for new push messages.
unregisterTokenListenerUnregisters a previously registered listener for a new push token.

isConnectMessageData

This helper method returns whether the message is from the Webex Connect platform or not.

Syntax: abstract fun isConnectMessageData(data: Map<String, String>): Boolean

Return: Boolean value indicating whether data contains a connect message.

Parameters

ParametersTypeDescription
dataMap<String, String>The map of data strings is to be checked.

processMessageData

This method is called to handle push messages received from Webex Connect platform.

Syntax: abstract fun processMessageData(data: Map<String, String>)

📘

Note:

This method call required only if application developer implements their own FirebaseMessagingService and requires connect SDK to process the push message received from connect platform.

Parameters:

ParametersTypeDescription
dataMap<String, String>The map of data strings to be processed.

Throws:

NameDescription
WebexConnectExceptionIf an error occurs while processing the message data.

processToken

This method processes the received Push token from the application.

📘

Note

This method call required only if application developer implements their own FirebaseMessagingService and requires to receive push messages from the Webex Connect platform.

Syntax: abstract fun processToken(token: String)

Parameters:

ParametersTypeDescription
tokenStringThe token string is to be processed.

Throws:

NameDescription
WebexConnectExceptionIf an error occurs while processing the token.

registerMessagingListener

Registers a listener for new push messages.

Syntax: abstract fun registerMessagingListener(listener: PushMessagingListener)

Parameters:

ParametersTypeDescription
listenerPushMessagingListenerThe PushMessagingListener is to be registered.

registerTokenListener

Registers a listener for a new push token.

Syntax: abstract fun registerTokenListener(listener: PushTokenListener)

Parameters:

ParametersTypeDescription
listenerPushTokenListenerThe PushTokenListener is to be registered.

requestNotificationPermission

Requests the system notification permission prompt to enable notifications display on Android 13 devices. This permission is required for apps that target Android API level 33 to allow an app to post notifications

Syntax: abstract fun requestNotificationPermission(callback: NotificationPermissionCallback? = null)

Parameters:

ParametersTypeDescription
callbackNotificationPermissionCallbackInvoked when the user accepts or declines the notification permission prompt.

sendMessageStatus

Updates the status of one or more messages.

Syntax: abstract fun sendMessageStatus(vararg messageTransactionIds: String, status: PushMessageStatus, callback: SendMessageStatusCallback? = null)

Parameters:

ParametersTypeDescription
messageTransactionIdsStringThe array of message transactionId(s) whose status is to be sent.
statusPushMessageStatusThe status of the message(s).
callbackSendMessageStatusCallbackThe callback function is to be invoked after sending message status.

sendMessageStatus

Sends status of a message.

Syntax: abstract fun sendMessageStatus(messageTransactionId: String,status: PushMessageStatus, interactiveData: PushInteractiveData? = null, callback: SendMessageStatusCallback? = null)

Parameters:

NameTypeDescription
messageTransactionIdStringThe transactionId whose status is to be sent.
statusPushMessageStatusThe status of the message.
interactiveDataPushInteractiveDataThe interactive data is to be sent with the message status.
callbackSendMessageStatusCallbackThe callback function is to be invoked after sending message status.

unregisterMessagingListener

Unregisters a previously registered listener for new push messages.

Syntax: abstract fun unregisterMessagingListener(listener: PushMessagingListener)

Parameters:

ParametersTypeDescription
listenerPushMessagingListenerThe PushMessagingListener to be unregistered.

unregisterTokenListener

Unregisters a previously registered listener for a new push token.

Syntax: abstract fun unregisterTokenListener(listener: PushTokenListener)

Parameters:

ParametersTypeDescription
listenerPushTokenListenerThe PushTokenListener to be unregistered.

shutdown

Syntax: abstract fun shutdown()

startup

Syntax: abstract fun startup()