ChatEventListener

The listener the host application implements to receive chat lifecycle events, error notifications, and incoming chat elements.

Implementing this interface allows the host application to respond to chat state changes, handle link taps, and receive error notifications.

Usage:

class MyActivity : AppCompatActivity(), ChatEventListener {
override fun onChatStateChanged(stateEvent: StateEvent) { /* react to state */}
override fun onError(error: NRError) { /* handle errors */}
override fun onChatElementReceived(chatElement: ChatElement) { /* handle elements */}
}

val controller = ChatController.Builder(this)
.chatEventListener(this)
.build(account, chatLoadedListener)

Functions

Link copied to clipboard
open fun onChatElementReceived(chatElement: ChatElement)

Called when a new chat element is received from the chat engine.

Link copied to clipboard
open fun onChatStateChanged(stateEvent: StateEvent)

Notifies the listener that the chat session's lifecycle state has changed.

Link copied to clipboard
open fun onError(error: NRError)

Notifies the listener that an error occurred during a SDK operation.

Link copied to clipboard
open fun onPhoneNumberSelected(phoneNumber: String)

Notifies the listener that the user tapped a phone number rendered in the chat.

Link copied to clipboard

Notifies the listener that the user tapped the upload-file affordance in the chat input.

Link copied to clipboard

Notifies the listener that the user tapped a URL rendered in the chat, allowing the host to handle the link and override the SDK's default action.