displayNotification

fun displayNotification(context: Context, contentTitle: String, contentText: String, payload: Map<String, String>, smallIcon: Int = R.drawable.ic_default_notification, autoCancel: Boolean = true, priority: Int = NotificationCompat.PRIORITY_HIGH, historyIntents: List<Intent> = emptyList()): Boolean

Handles and displays a push notification using the TWS SDK.

This method processes notification payloads (typically from FCM or similar services) and displays a notification to the user using the provided details. The notification is only shown if the SDK recognizes the payload as a supported TWS notification (i.e., it includes the necessary fields and a supported type).

Typical usage is from your FirebaseMessagingService.onMessageReceived, passing in the relevant notification data. You may customize the notification appearance via contentTitle, contentText, smallIcon, etc. Optionally, you can pass a navigation back stack (historyIntents) for proper navigation when the notification is opened.

Return

true if the notification was handled and displayed by the SDK, false otherwise.

Parameters

context

The context for displaying the notification (usually the application context).

contentTitle

The title to display in the notification.

contentText

The message/body to display in the notification.

payload

The notification payload as a Map (typically from FCM's remoteMessage.data), must include at least projectId, snippetId, and type for SDK to recognize and handle notification.

smallIcon

The resource ID of the small icon to show in the notification. Defaults to TWS SDK's default icon.

autoCancel

Whether to dismiss the notification when tapped. Default is true.

priority

The notification priority (see NotificationCompat). Default is NotificationCompat.PRIORITY_HIGH.

historyIntents

An optional list of Intents representing previous navigation history to construct the back stack.