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
Name | Type |
---|---|
Companion | object Companion |
Companin Properties
Name | Type | Description |
---|---|---|
instance | PushMessaging | The singleton instance of PushMessaging. |
Properties
Name | Type | Description |
---|---|---|
actionHandler | NotificationActionHandler | This property represents the handler for notification actions. This can be set to different implementations of the NotificationActionHandler interface, which handles user interactions with notifications. |
inAppNotificationManager | InAppNotificationManager | The in-app notification manager for handling banner and modal inApp Notifications. |
notificationFactory | NotificationFactory | Factory 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. |
priority | Int | The priority of the module. Higher-priority modules are started before lower-priority modules. |
provider | PushProvider | This 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. |
pushToken | String | This property holds the token for the push notification service. This token is used to uniquely identify the device for receiving push notifications. |
Functions
Function Name | Description |
---|---|
isConnectMessageData | This helper method returns whether the message is from the Webex Connectplatform or not. |
processMessageData | Processes received message data. |
processToken | Processes received token. |
registerMessagingListener | Registers a listener for new push messages. |
registerTokenListener | Registers a listener for a new push token. |
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. |
sendMessageStatus | Updates the status of one or more messages. |
Sends the status of a message. | |
shutdown | Performs the shutdown operations for the Push Messaging module. |
startup | Performs the startup operations for the Push Messaging module. |
unregisterMessagingListener | Unregister a previously registered listener for new push messages. |
unregisterTokenListener | Unregisters 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
Parameters | Type | Description |
---|---|---|
data | Map<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:
Parameters | Type | Description |
---|---|---|
data | Map<String, String> | The map of data strings to be processed. |
Throws:
Name | Description |
---|---|
WebexConnectException | If 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:
Parameters | Type | Description |
---|---|---|
token | String | The token string is to be processed. |
Throws:
Name | Description |
---|---|
WebexConnectException | If an error occurs while processing the token. |
registerMessagingListener
Registers a listener for new push messages.
Syntax: abstract fun registerMessagingListener(listener: PushMessagingListener)
Parameters:
Parameters | Type | Description |
---|---|---|
listener | PushMessagingListener | The PushMessagingListener is to be registered. |
registerTokenListener
Registers a listener for a new push token.
Syntax: abstract fun registerTokenListener(listener: PushTokenListener)
Parameters:
Parameters | Type | Description |
---|---|---|
listener | PushTokenListener | The 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:
Parameters | Type | Description |
---|---|---|
callback | NotificationPermissionCallback | Invoked 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:
Parameters | Type | Description |
---|---|---|
messageTransactionIds | String | The array of message transactionId(s) whose status is to be sent. |
status | PushMessageStatus | The status of the message(s). |
callback | SendMessageStatusCallback | The 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:
Name | Type | Description |
---|---|---|
messageTransactionId | String | The transactionId whose status is to be sent. |
status | PushMessageStatus | The status of the message. |
interactiveData | PushInteractiveData | The interactive data is to be sent with the message status. |
callback | SendMessageStatusCallback | The 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:
Parameters | Type | Description |
---|---|---|
listener | PushMessagingListener | The PushMessagingListener to be unregistered. |
unregisterTokenListener
Unregisters a previously registered listener for a new push token.
Syntax: abstract fun unregisterTokenListener(listener: PushTokenListener)
Parameters:
Parameters | Type | Description |
---|---|---|
listener | PushTokenListener | The PushTokenListener to be unregistered. |
shutdown
Syntax: abstract fun shutdown()
startup
Syntax: abstract fun startup()
Updated about 1 month ago