Android Chatbot UI Kit

View Release Notes →

dialogs_ChatbotAV_Android is a pre-built, fully managed chat and video-calling UI for Android. It's built on the same WebView-driven chat engine as the Chatbot SDK; what it adds is a native audio/video calling layer powered by Enx_UIKit_Android, Enx-Rtc-Android and libwebrtc, so calls can run as native EnableX video sessions rather than only inside a WebView. It ships three integration levels — the drop-in EnxChatClient view, an EnxChatFragment wrapper, and a headless EnxChatSession — plus a Compose-native EnxChat composable.

Android Chatbot UI Kit v1.0.0  ·  Released July 16, 2026

First release of the Android Chatbot UI Kit. See Release Notes for what's included.

  Download Android Chatbot UI Kit v1.0.0
Setup

Requirements

RequirementValue
minSdkVersion24
compileSdk / targetSdk36
Kotlin2.0.21
Android Gradle Plugin9.0.1
Compose BOM2024.09.00
Java source/target compatibility11

Depends on: Enx_UIKit_Android 2.2.3 → Enx-Rtc-Android → libwebrtc (see Dependency Chain)

Installation

Option A — Source Module

// settings.gradle.kts
include(":dialogs_ChatbotAV_Android")

// app/build.gradle.kts
dependencies {
    implementation(project(":dialogs_ChatbotAV_Android"))
}

Option B — Standalone AAR

dependencies {
    implementation(files("libs/dialogs_ChatbotAV_Android-1.0.0.aar"))
}

Required Permissions

Add these to your app's AndroidManifest.xml. They also merge in automatically from the SDK and its bundled AARs, but you should still be aware of them since several require runtime consent.

<!-- Always required — plain chat -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- Required only if you enable audio/video call actions (EnxChatConfig(isCallView = true)) -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />

Gradle's manifest merger pulls these in from three sources: the UI Kit module itself, Enx_UIKit_Android, and Enx-Rtc-Android.

PermissionDeclared byRequired for
INTERNETUI Kit + Enx-Rtc-AndroidAlways — chat networking
ACCESS_NETWORK_STATEUI Kit + Enx-Rtc-AndroidAlways — connectivity checks
CAMERAUI KitVideo calls (both call paths)
RECORD_AUDIOUI Kit + Enx-Rtc-AndroidAudio and video calls
MODIFY_AUDIO_SETTINGSUI Kit + Enx_UIKit_AndroidAudio routing during calls
WAKE_LOCKEnx_UIKit_AndroidKeeps the CPU awake during an active call
FOREGROUND_SERVICEEnx_UIKit_Android + Enx-Rtc-AndroidKeeps a call running in the background
FOREGROUND_SERVICE_MEDIA_PROJECTIONEnx_UIKit_AndroidMedia projection foreground service type
SYSTEM_ALERT_WINDOWEnx_UIKit_AndroidCall overlay drawn over other apps
BLUETOOTH (≤ API 30), BLUETOOTH_CONNECT, BLUETOOTH_SCAN, BLUETOOTH_ADVERTISEEnx-Rtc-AndroidBluetooth headset audio routing during calls

Before starting a call, request the dangerous runtime permissions yourself:

ActivityCompat.requestPermissions(
    this,
    arrayOf(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO),
    REQUEST_CODE_CALL_PERMISSIONS
)

SYSTEM_ALERT_WINDOW (“display over other apps”) cannot be requested via a runtime dialog — direct users to Settings.ACTION_MANAGE_OVERLAY_PERMISSION if your target devices need the call overlay. On Android 12+, also request BLUETOOTH_CONNECT/BLUETOOTH_SCAN if you want Bluetooth headset routing during calls.

Usage Patterns

Pattern 1 — Jetpack Compose (Quick Start)

@Composable
fun ChatScreen(botId: String, host: String) {
    val config = remember { EnxChatConfig(botId = botId, host = host) }

    AndroidView(
        factory = { context ->
            val activity = context as ComponentActivity
            EnxChatClient(context).apply {
                bindToLifecycle(owner = activity)
                start(config, object : EnxChatBotListener() {
                    override fun onBotConnected(botConnectedInfo: BotInfo) { /* update your header, etc. */ }
                    override fun onClose() { /* pop the screen */ }
                })
            }
        }
    )
}

Pattern 2 — Compose with a Custom App-Owned Header

var botName by remember { mutableStateOf("Assistant") }
var enxChatClient by remember { mutableStateOf<EnxChatClient?>(null) }

Column {
    Row {
        Text(botName)
        EnxCallView(iconTint = Color(0xFF111B21))          // shows call icons only if isCallView = true
        IconButton(onClick = { enxChatClient?.resetConversation() }) { /* refresh icon */ }
    }
    AndroidView(
        factory = { context ->
            EnxChatClient(context).apply {
                bindToLifecycle(this@MyActivity)
                start(
                    EnxChatConfig(botId = botId, host = host, isCallView = true),
                    object : EnxChatBotListener() {
                        override fun onBotConnected(botInfo: BotInfo) {
                            botName = botInfo.name.ifBlank { "Assistant" }
                        }
                        override fun onClose() { finish() }
                    }
                )
                enxChatClient = this
            }
        }
    )
}

Pattern 3 — Kotlin (Plain View / Activity)

class ChatActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val config = EnxChatConfig(botId = "YOUR_BOT_ID", host = "https://your-host.example.com")

        val chatClient = EnxChatClient(this)
        setContentView(chatClient)
        chatClient.bindToLifecycle(owner = this)
        chatClient.start(config, object : EnxChatBotListener() {
            override fun onBotConnected(botConnectedInfo: BotInfo) {}
            override fun onClose() { finish() }
        })
    }
}

Pattern 4 — Java

public class ChatActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        EnxChatClient chatClient = new EnxChatClient(this);
        setContentView(chatClient);

        EnxChatConfig config = new EnxChatConfig("YOUR_BOT_ID", "https://your-host.example.com");

        chatClient.bindToLifecycle(this);
        chatClient.start(config, new EnxChatBotListener() {
            @Override
            public void onBotConnected(BotInfo botConnectedInfo) {}

            @Override
            public void onClose() { finish(); }
        });
    }
}

Pattern 5 — Fragment-First Apps

val fragment = EnxChatFragment.newInstance(botId = "YOUR_BOT_ID", host = "https://your-host.example.com")
supportFragmentManager.beginTransaction()
    .replace(R.id.container, fragment)
    .commit()

// After the fragment's view is created:
fragment.setUiListener(object : EnxChatBotListener() {
    override fun onBotConnected(botConnectedInfo: BotInfo) {}
    override fun onClose() {}
})
fragment.bindToHostLifecycle()
fragment.start()

Listening to Richer Events

For anything beyond “connected”/“closed”, use setSessionListener(...) in addition to (or instead of) setUiListener(...):

chatClient.setSessionListener(object : EnxChatSessionListenerAdapter() {
    override fun onBotMessage(chatMessage: ChatMessage) { /* render/log */ }
    override fun onTyping(isTyping: Boolean) { /* show typing indicator */ }
    override fun onError(error: String) { /* surface to user / log */ }
    override fun onVideoCallRequested(iFrameUrl: String) { /* SDK auto-launches the call screen; observe only if needed */ }
    override fun onNativeUIKitCallRequested(roomToken: String) { /* same — native call path */ }
})

Both call-request callbacks are informational — EnxChatClient/EnxChat already launch EnxVideoCallActivity automatically when the bot requests a call. You do not need to start it yourself.

Sending Messages, Attachments, and Files

// Plain text (via EnxChatSession, if using the headless API)
session.sendMessage("Hello!")

// With a file attachment (image/document/video picked via a system picker Uri)
session.sendMessage(
    text = "Here's my document",
    attachments = listOf(ChatAttachment(uri = pickedUri, type = AttachmentType.DOCUMENT))
)

EnxChatClient's built-in chat UI (EnxChatScreen) already wires up the attachment picker (camera, gallery, document, emoji) for you — most apps never need to call sendMessage/sendFile directly unless they're building a fully custom UI on top of EnxChatSession/EnxChat.

Resetting a Conversation

chatClient.resetConversation()       // EnxChatClient
fragment.resetConversation()         // EnxChatFragment
session.resetConversation()          // EnxChatSession
controller.resetConversation()       // EnxChatController, from EnxChat composable

Tearing Down Correctly

Always prefer bindToLifecycle(owner) so disconnect()/release() happen automatically. If managing lifecycle manually:

override fun onDestroy() {
    chatClient.disconnect()
    chatClient.release()
    super.onDestroy()
}

EnxChatClient also calls release() automatically in onDetachedFromWindow() as a safety net against leaked WebViews.

Audio & Video Calling

Calling is built in. When the bot starts a call, the UI Kit opens its own call screen (EnxVideoCallActivity) and brings the user back to the chat when the call ends. You don't write any call code; you only enable the call buttons and grant permissions.

Enabling call buttons

  • Set EnxChatConfig(isCallView = true) to show the audio and video call icons in the chat header.
  • If your app draws its own header, place EnxCallView in it (see Pattern 2). It renders nothing unless isCallView = true.
  • Taps on these icons are reported through onAudioCallClick() and onVideoCallClick().
  • If the bot's BotInfo.clickToCall is anything other than "text", the UI Kit shows a minimal click-to-call screen (EnxClickToCallMinimalScreen, a single “Start call” button plus a status line) instead of the full chat screen.

The two call paths

The bot's call payload decides which path runs. Both open EnxVideoCallActivity.

Path A — browser callPath B — native call
Payload containsAn iFrameURLA roomToken
Listener callbackonVideoCallRequested(iFrameUrl)onNativeUIKitCallRequested(roomToken)
Call surfaceA dedicated WebView, separate from the chat WebViewEnxVideoView from Enx_UIKit_Android
Calling engineWhatever the call page loads in the WebViewEnx-Rtc-Android + libwebrtc
Picture-in-Picture—Yes, 9:16, on back-press or when the user leaves the app

Both callbacks are informational — observe them for analytics or logging; the UI Kit has already launched the call screen. When either call ends, onVideoCallEnded() fires and the chat Activity returns to the foreground.

How a native call runs

  1. EnxVideoCallActivity configures EnxSetting: pre-screening, audio/video mode, and the call events it wants to receive (AUDIO, VIDEO, SWITCH_CAMERA, SWITCH_AUDIO, DISCONNECT).
  2. It creates an EnxVideoView with the room token and adds it to the screen. EnxVideoView uses Enx-Rtc-Android to join the EnableX video room.
  3. The activity receives call state through EnxVideoStateObserver (disconnect, connectError, onPageSlide, onUserDataReceived).
  4. On disconnect, the activity closes and returns the user to the chat.

See the call sequence diagram for both paths step by step.

Audio-only native calls are not available yet. EnxAudioViewConfig (the audio-only call UI) is present in the UI Kit, but native calls currently always start in video mode.

Supported Media Types

Sending (User → Bot)

Type (AttachmentType)Source in the built-in chat screen
IMAGECamera or gallery, from the attachment sheet
VIDEOGallery, from the attachment sheet
DOCUMENTSystem document picker, from the attachment sheet
EMOJIEmoji picker, from the attachment sheet

When sending from your own UI, sendMessage(text, attachments) accepts a Uri, File, ByteArray or raw base64 String. The UI Kit detects the file name and MIME type and base64-encodes the file off the main thread before passing it to the chat.

Receiving (Bot → User)

ContentRendered As
TextMessage bubble, with Markdown (including tables and strikethrough)
Quick replies / buttonsSingle- or multi-choice chips and buttons; calendar quick replies open a date picker
ImageInline preview with a fullscreen viewer
VideoInline preview with a fullscreen player
DocumentIn-app viewer for PDF (paginated), JSON (pretty-printed, syntax-highlighted), CSV (table view), HTML, Markdown and plain/code text; other types open in an external app
Cards / carouselsStructured card layouts
System messagesStatus notices, such as live-agent handover
API Reference

EnxChatConfig data class · com.dialogs_chatbotav_android.core

data class EnxChatConfig @JvmOverloads constructor(
    val botId: String,
    val host: String,
    val path: String = "",
    val isCallView: Boolean = false,
    val enableHistory: Boolean = false
)
FieldRequiredDescription
botIdYesEnableX chatbot identifier.
hostYesBase API host. Must start with http:// or https:// or the SDK reports ENX_CONFIG_INVALID: host must start with http:// or https://.
pathNoReserved/advanced routing path.
isCallViewNoEnables the built-in audio/video call action icons in the chat UI header (see EnxCallView).
enableHistoryNoEnables conversation history restoration.

Validation errors reported via the active listener's onError(String): ENX_CONFIG_INVALID: botId is required, ENX_CONFIG_INVALID: host is required, ENX_CONFIG_INVALID: host must start with http:// or https://.

EnxChatState enum

CREATED · INITIALIZING · INITIALIZED · CONNECTING · CONNECTED · DISCONNECTED · ERROR · RELEASED

EnxChatSessionListener interface — all methods have default no-op bodies

interface EnxChatSessionListener {
    fun onStateChanged(state: EnxChatState) {}
    fun onChatReady() {}
    fun onConnected(sessionId: String) {}
    fun onConversationReady(conversationId: String) {}
    fun onMessageSent(message: String) {}
    fun onBotResponse(message: String) {}
    fun onBotMessage(chatMessage: ChatMessage) {}
    fun onTyping(isTyping: Boolean) {}
    fun onDisconnected() {}
    fun onBotInfo(botInfo: BotInfo) {}
    fun onClear(dataJson: String) {}
    fun onConversationReset(dataJson: String) {}
    fun onAudioCallClick() {}
    fun onVideoCallClick() {}
    fun onError(error: String) {}
    fun onVideoCallRequested(iFrameUrl: String) {}
    fun onNativeUIKitCallRequested(roomToken: String) {}
    fun onVideoCallEnded() {}
}

Use EnxChatSessionListenerAdapter (an open class implementing this interface with empty overrides) from Java to override only what you need.

EnxChatSession Level 3 — headless API

class EnxChatSession {
    companion object {
        @JvmStatic fun create(activity: Activity, config: EnxChatConfig): EnxChatSession
        @JvmStatic @JvmOverloads fun create(
            activity: Activity, botId: String, host: String,
            path: String = "", isCallView: Boolean = false, enableHistory: Boolean = false
        ): EnxChatSession
    }

    val state: StateFlow<EnxChatState>

    fun setSessionListener(listener: EnxChatSessionListener?)
    fun addSessionListener(listener: EnxChatSessionListener)
    fun removeSessionListener(listener: EnxChatSessionListener)

    fun initialize()
    fun connect()
    @JvmOverloads fun initializeAndConnect(forceConnectState: Boolean = true)
    fun start()  // = initializeAndConnect(true)

    @JvmOverloads fun sendMessage(text: String, attachments: List<ChatAttachment> = emptyList())
    fun disconnect()
    fun resetConversation()
    fun release()

    fun getWebView(): WebView
    fun saveState(): Bundle?
    fun restoreState(savedState: Bundle?)
    fun getCurrentState(): EnxChatState
}

Use this only for headless lifecycle control or custom UI orchestration; standard apps should use EnxChatClient.

EnxChatClient extends android.widget.FrameLayout — Level 1 & 2, recommended API

The default, recommended integration point — usable directly as a Kotlin/Java View, or wrapped in Jetpack Compose via AndroidView.

class EnxChatClient @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr) {

    fun setConfig(config: EnxChatConfig)

    @JvmOverloads fun start(config: EnxChatConfig, listener: EnxChatBotListener? = null)

    @JvmOverloads fun startWithBot(
        botId: String, host: String, path: String = "",
        isCallView: Boolean = false, enableHistory: Boolean = false,
        listener: EnxChatBotListener? = null
    )

    @JvmOverloads fun bindToLifecycle(
        owner: LifecycleOwner, disconnectOnStop: Boolean = false, releaseOnDestroy: Boolean = true
    )
    fun unbindFromLifecycle()

    fun initialize()
    fun connect()
    fun disconnect()
    fun release()
    fun getState(): EnxChatState

    fun setProfilePictureUrl(url: String?)
    fun setHeaderColor(@ColorInt colorInt: Int)
    fun setUiListener(listener: EnxChatBotListener?)
    fun setSessionListener(listener: EnxChatSessionListener?)
    fun resetConversation()

    @Deprecated("Use startWithBot(...) or start(EnxChatConfig, listener)")
    @JvmOverloads fun setBotIdAndHost(
        botId: String, host: String, path: String = "",
        isCallView: Boolean = false, enableHistory: Boolean = false
    )
}

Standard lifecycle (ready-made mode): start(...) → disconnect() → release()
Lifecycle-safe mode (recommended): bindToLifecycle(owner) + start(...) — disconnect/release handled automatically on onStop/onDestroy
Explicit lifecycle (advanced): initialize() → connect() → disconnect() → release()

EnxChatClient automatically persists/restores WebView state across configuration changes (e.g. screen rotation) via onSaveInstanceState/onRestoreInstanceState, and calls release() automatically in onDetachedFromWindow() as a leak-safety net.

EnxChatBotListener abstract class — simplified, user-facing callbacks

abstract class EnxChatBotListener {
    open fun onBotConnected(botConnectedInfo: BotInfo) {}
    open fun onClose() {}
}

This is intentionally the smallest listener surface for apps that just want “chat connected” + “user closed chat” signals. For richer events (messages, typing, errors, call requests), use EnxChatSessionListener via setSessionListener(...).

EnxChatFragment extends androidx.fragment.app.Fragment — Level 2

class EnxChatFragment : Fragment() {
    companion object {
        @JvmStatic @JvmOverloads fun newInstance(
            botId: String, host: String, path: String = "",
            isCallView: Boolean = false, enableHistory: Boolean = false
        ): EnxChatFragment
    }

    fun setUiListener(listener: EnxChatBotListener?)
    fun setSessionListener(listener: EnxChatSessionListener?)
    @JvmOverloads fun bindToHostLifecycle(disconnectOnStop: Boolean = false, releaseOnDestroy: Boolean = true)
    @JvmOverloads fun bindToLifecycle(owner: LifecycleOwner, disconnectOnStop: Boolean = false, releaseOnDestroy: Boolean = true)

    fun start()
    fun initialize()
    fun connect()
    fun disconnect()
    fun release()
    fun resetConversation()
    fun getState(): EnxChatState?
}

Use only when your host architecture is fragment-first; internally it just creates and delegates to an EnxChatClient.

Compose-Native API com.dialogs_chatbotav_android.ui.compose

EnxChat (composable)

@Composable
fun EnxChat(
    enxChatConfig: EnxChatConfig,
    session: EnxChatSession? = null,
    sessionListener: EnxChatSessionListener? = null,
    controller: EnxChatController? = null,
    profilePictureUrl: String? = null,
    headerColor: Color = Color.White,
    onSdkReady: (() -> Unit)? = null,
    onBotInfo: ((BotInfo) -> Unit)? = null,
    onAudioCallClick: (() -> Unit)? = null,
    onVideoCallClick: (() -> Unit)? = null,
    onMessageSent: ((String, List<ChatAttachment>) -> Unit)? = null,
    onBotResponse: ((String, List<ChatAttachment>) -> Unit)? = null,
    onClose: (() -> Unit)? = null,
    modifier: Modifier = Modifier
)

If session is omitted, EnxChat creates and owns its own EnxChatSession internally (recreated automatically if enxChatConfig changes, released on composable disposal). Prefer EnxChatClient via AndroidView unless you specifically need Compose-native customization.

EnxChatController

class EnxChatController {
    fun resetConversation()
}

Pass into EnxChat(controller = ...) to trigger a conversation reset imperatively from outside the composable.

EnxCallView (composable)

@Composable
fun EnxCallView(
    onAudioCallClick: (() -> Unit)? = null,
    onVideoCallClick: (() -> Unit)? = null,
    iconTint: Color = Color.Black,
    modifier: Modifier = Modifier
)

Renders audio/video call icon buttons for a custom app-owned header; renders nothing unless EnxChatConfig.isCallView = true was used for the active session. If click handlers are omitted, falls back to the handlers registered by the active EnxChat/EnxChatClient instance.

Models

com.dialogs_chatbotav_android.model.chat

enum class AttachmentType { IMAGE, VIDEO, DOCUMENT, EMOJI }

data class ChatAttachment(
    val uri: Uri? = null,
    val url: String? = null,
    val type: AttachmentType,
    val fileName: String? = null,
    val fileSize: Long? = null,
    val mimeType: String? = null
)

data class QuickReply(
    val title: String,
    val payload: String? = null,
    val type: String? = null   // "postback" | "url" | "phone_number" | "calendar" ...
)

enum class MessageType {
    TEXT, QUICK_REPLY, BUTTONS, IMAGE, VIDEO, AUDIO, FILE, CARD, CAROUSEL, SYSTEM, UNKNOWN
}

data class ChatMessage(
    val id: String = UUID.randomUUID().toString(),
    val text: String = "",
    val isFromUser: Boolean,
    val timestamp: Long = System.currentTimeMillis(),
    val attachments: List<ChatAttachment> = emptyList(),
    val messageType: MessageType = MessageType.TEXT,
    val quickReplies: List<QuickReply> = emptyList(),
    val buttons: List<QuickReply> = emptyList(),
    val allowMultiple: Boolean = false,
    val rawData: Map<String, Any>? = null
)

ChatAttachment.type and ChatMessage.isFromUser have no default value — when constructing these from Java or by position, supply them explicitly.

com.dialogs_chatbotav_android.model.botinfo

data class BotInfo(
    val showBotInfoPage: Boolean = false,
    val name: String = "",
    val description: String = "",
    val details: BotDetails = BotDetails(),
    val startupMessage: String = "",
    val selfTriggeredBot: Boolean = false,
    val embeddedMediaIframe: String? = null,
    val clickToCall: String = "text",     // "text" = full chat UI, else minimal click-to-call UI
    val agentHuntingStatusMessage: AgentHuntingStatusMessage? = null,
    val chatTheme: ChatTheme = ChatTheme(),
    val startupForm: StartupForm = StartupForm(),
    val languages: List<String> = emptyList(),
    val disableNotificationSound: Boolean = false,
    val security: Security = Security(),
    val lazySocket: Boolean = false,
    val maxMessageLength: Int = 1000,
    val alwaysScrollDownOnMessages: Boolean = false
)

BotInfo.clickToCall == "text" (default) renders the full chat UI (EnxChatScreen); any other value renders the minimal click-to-call UI (EnxClickToCallMinimalScreen) — a single “Start call” button plus status line, themed from chatTheme.theme.

Nested types: BotDetails (contact/legal URLs, avatar/cover images), AgentHuntingStatusMessage (status copy while waiting for a live agent), ChatTheme/UserTheme/BotTheme/WidgetTheme (colors, bubble style, widget position), StartupForm (pre-chat form field toggles), Security (escapeHTML).

BotInfoParser (internal object) — fun parse(jsonString: String): BotInfo? — parses the raw JSON delivered by Android.onBotInfo(...); returns null on malformed JSON (caught internally, logged, onError is not raised for this specific case).

Error / Event Reference

EventSourceMeaning
onError("ENX_CONFIG_INVALID: ...")EnxChatClient/EnxChatSessionConfig validation failed before session start.
onError("WebView error: <description>")EnxChatBot (WebViewClient.onReceivedError)Main-frame WebView load failure.
onError("Failed to send file: <message>")EnxChatBot.sendFileFile read/base64/JS-bridge failure while sending an attachment.
onError("Conversation reset function is not available in web client")EnxChatBot.resetConversationLoaded web client version doesn't expose any known reset function.
onDisconnected()EnxChatBot.disconnectAlways fires after a disconnect() call, regardless of whether the web client exposed a disconnect function.
Architecture

Layered Architecture

The host app talks only to the public API. Below it, the UI Kit is split into a Compose UI layer, a WebView + JS bridge layer, and a call layer. Native calls run on a chain of vendored binaries, and two remote services sit underneath.

Layered architecture: host app, the UI Kit's public API, Compose UI, WebView + JS bridge and call layers, the call WebView for Path A, the Enx_UIKit_Android → Enx-Rtc-Android → libwebrtc chain for Path B, and the voiceassist.enablex.io and EnableX Video services.
Green = this UI Kit, purple = vendored native calling chain, blue = your app and remote services.
LayerResponsibility
Public APIFour entry points that all drive the same engine: EnxChatClient (View, Level 1), EnxChatFragment (Level 2), EnxChatSession (headless, Level 3) and the EnxChat composable.
Compose UI layerThe chat screen, the minimal click-to-call screen, EnxCallView, the attachment picker and ChatViewModel.
WebView + JS bridge layerHosts a WebView running the EnableX chatbot web client from voiceassist.enablex.io, and bridges its JavaScript events to Kotlin through AndroidBridge (@JavascriptInterface). Your host, botId and path are handed to the web client over the bridge; conversation logic lives in the web client.
Call layerEnxVideoCallActivity, which runs Path A in its own WebView or Path B through Enx_UIKit_Android. It is the only class that uses Enx_UIKit_Android, so the calling dependency never touches the chat code path.
Enx_UIKit_AndroidProvides the native call surface: EnxVideoView, EnxSetting, EnxVideoStateObserver and EnxAudioViewConfig.
Enx-Rtc-Android / libwebrtcThe calling engine: room signaling, Bluetooth audio routing, the call foreground service and battery-aware call handling (Enx-Rtc-Android), on top of Google's native WebRTC media engine (libwebrtc).

Dependency Chain

The calling layer depends on Enx_UIKit_Android 2.2.3 → Enx-Rtc-Android → libwebrtc. All three ship as prebuilt AARs inside the UI Kit's libs/ folder, not from a Maven repository:

// dialogs_ChatbotAV_Android/build.gradle.kts
implementation(files("libs/Enx_UIKit_Android-2.2.3.aar"))   // com.enablex.enxuikit_android
implementation(files("libs/Enx-Rtc-Android-release.aar"))  // com.enablex.enx_rtc_android
implementation(files("libs/libwebrtc.aar"))                // org.webrtc

The UI Kit also needs these runtime libraries:

LibraryVersionWhy
com.google.android.exoplayer:exoplayer2.19.1Video playback, required by Enx_UIKit_Android
com.google.code.gson:gson2.10.1Required by Enx_UIKit_Android at class-init time
com.intuit.sdp:sdp-android1.1.1Scalable dp units used by Enx_UIKit_Android layouts
io.socket:socket.io-client2.1.2Used by the UI Kit
io.noties.markwon:*4.6.2Markdown rendering in chat bubbles
io.coil-kt:coil-compose2.5.0Image loading

Because the calling AARs are vendored files:

  • No automatic version resolution. Upgrading Enx_UIKit_Android means replacing the .aar in libs/ and updating the filename in build.gradle.kts.
  • No transitive conflict detection. If a newer UI Kit build raises its own minimums (for example ExoPlayer or Gson), you must reconcile them by hand.
  • Re-check the merged manifest after any AAR swap. An upgrade can add new permissions or components.
  • Re-test both call paths after an upgrade. They share EnxVideoCallActivity but work completely differently inside it.

Sequence & State Diagrams

Click any diagram to open it at full size.

Chat startup & messaging

From EnxChatClient.start() through the WebView handshake to a round-trip user/bot message and teardown.

Sequence diagram of chat startup, connect, sending and receiving a message, disconnect and release.
Solid arrows are direct calls; dashed arrows are asynchronous JavaScript → Kotlin callbacks delivered through AndroidBridge.

Audio/video call

Both call paths, from the bot's call payload to the call ending and the user returning to the chat.

Sequence diagram of Path A (iFrame URL loaded in a call WebView) and Path B (room token passed to EnxVideoView, which joins the room through Enx-Rtc-Android).
Path A needs only the WebView; Path B goes through Enx_UIKit_Android and Enx-Rtc-Android.

Session state machine

The lifecycle of a session, exposed as EnxChatState through getState(), getCurrentState() and state: StateFlow.

State diagram of EnxChatState: CREATED, INITIALIZING, INITIALIZED, CONNECTING, CONNECTED, DISCONNECTED, ERROR and RELEASED.
bindToLifecycle(owner) drives the disconnect() and release() transitions for you.

Component Diagram

This diagram shows internal classes for orientation only. Apps can call only the types listed in the API Reference.

Component diagram: EnxChatFragment creates EnxChatClient, which creates EnxChatSession; EnxChatSession owns EnxChatBot, which registers AndroidBridge; the chat screen launches EnxVideoCallActivity, which uses Enx_UIKit_Android for native calls.
Green = this UI Kit, blue = listeners and models, purple = external dependency (Enx_UIKit_Android). Solid = owns or creates; dotted = notifies or launches.

Two listener types, on purpose. EnxChatBotListener is the minimal “connected / closed” listener. EnxChatSessionListener carries every session event (state, messages, typing, calls, errors). Use the first for a simple integration and the second when you need more.

Feature Support

Feature Support (v1.0.0)

FeatureSupportedNotes
Three integration levelsYesEnxChatClient (View), EnxChatFragment (Fragment), EnxChatSession (headless), plus a Compose-native EnxChat composable.
Full chat screen (EnxChatScreen)YesDate separators, typing indicator, WhatsApp-style attachment sheet (camera/gallery/document/emoji), quick-reply single- and multi-choice selection, calendar/date-picker quick replies.
Rich in-message attachment previewsYesImage/video fullscreen viewers; document viewer supporting PDF (paginated), JSON (pretty-printed + syntax highlighting), CSV (table view), HTML, Markdown, and plain/code text, with an “open externally” fallback for unsupported types.
Markdown renderingYesVia Markwon (tables + strikethrough extensions).
Message de-duplicationYesJS bridge safeguards (processedBotMessageKeys/processedHistoryEntryKeys) avoid duplicate bubbles from history replay.
Conversation reset detectionYesFree-text bot copy (e.g. “reset conversation”) in addition to explicit quick-reply/button reset actions.
Response timeout fallbackYesA 30-second timeout injects a friendly “having trouble responding” system message if the bot doesn't answer in time.
Message queueing while disconnectedYesMessages sent before CONNECTED are queued and flushed automatically on connect.
Two independent call pathsYesBrowser/iFrame-based calls (onVideoCallRequested, rendered in a dedicated WebView) and native calls via the EnableX UIKit Android SDK (onNativeUIKitCallRequested, rendered using EnxVideoView/EnxSetting/EnxAudioViewConfig) — both launched via the internal EnxVideoCallActivity.
Picture-in-Picture during native callsYes9:16 aspect ratio, triggered on back-press or onUserLeaveHint.
Automatic return-to-chat navigationYescloseAndReturnToChat() brings the host chat Activity back to the foreground when a call ends.
File & attachment sendingYesAccepts Uri, File, ByteArray, or a raw base64 String; auto-detects file name/MIME type; base64-encodes off the main thread.
Config-change survivalYesonSaveInstanceState/onRestoreInstanceState persist WebView state across rotation.
Audio-only native callsNoEnxAudioViewConfig is wired but not currently reachable — isAudioOnly is hardcoded false.
Automatic JS-bridge re-registrationNoEnxChatBot.setEnxChatListener(...) does not re-register the JS bridge if called after initialization — set your listener before start()/initialize().
Reference

Threading Model

  • All @JavascriptInterface callback methods on the internal JS bridge are invoked by the WebView on a background thread (per Android's WebView JS-bridge contract) — they parse JSON synchronously, then call into your listener. Anything that touches Compose/View state downstream must marshal back to the main thread itself (Compose's mutableStateOf/StateFlow collectors handle this automatically; raw listener implementations that touch Views directly must runOnUiThread/post themselves).
  • File sending explicitly launches on Dispatchers.IO for file reading/base64 encoding, then switches to Dispatchers.Main before calling into the WebView (required — WebView APIs are main-thread-only).
  • EnxChatSession's listener fan-out takes a synchronized snapshot of the listener set before iterating, and wraps each callback in a try/catch so one misbehaving listener can't break delivery to the others or crash the bridge thread.

Known Limitations

  • Chat WebView URL is hardcoded to a fixed EnableX-hosted URL; the bundled offline assets are currently unreferenced.
  • SSL error handling differs between the chat WebView (blocks on error) and the call WebView (bypasses).
  • EnxChatBot.setEnxChatListener(...) doesn't re-register the JS interface if called after initialize() — only the first-set listener chain reliably receives callbacks post-init.
  • Audio-only native calls are not available yet — the audio-only call UI (EnxAudioViewConfig) is included, but native calls always start in video mode.

Common Configuration Errors

Error (delivered via onError)CauseFix
ENX_CONFIG_INVALID: botId is requiredEmpty botIdProvide a non-blank botId.
ENX_CONFIG_INVALID: host is requiredEmpty hostProvide a non-blank host.
ENX_CONFIG_INVALID: host must start with http:// or https://Missing schemePrefix host with https:// (recommended) or http://.
WebView error: <description>Network/WebView load failureCheck device connectivity; the chat client itself is loaded from a fixed EnableX-hosted URL, unrelated to your host value.
Call button does nothingisCallView not set, or CAMERA/RECORD_AUDIO not grantedSet EnxChatConfig(isCallView = true) and confirm runtime permissions were granted before the bot requests a call.

FAQ

Do I need to open the call screen myself?

No. When the bot starts a call, the UI Kit launches EnxVideoCallActivity on its own and returns to the chat when the call ends. onVideoCallRequested, onNativeUIKitCallRequested and onVideoCallEnded are there so you can observe calls, not to drive them. See Audio & Video Calling.

What decides whether a call is a browser call or a native call?

The bot's call payload. An iFrameURL opens a browser call in a WebView; a roomToken opens a native call through Enx_UIKit_Android. See The two call paths.

Are audio-only calls supported?

Not as native calls in v1.0.0 — native calls always start in video mode. See Known Limitations.

Do I have to add the permissions to my manifest?

No — they merge in automatically from the UI Kit and its AARs. You do have to request CAMERA, RECORD_AUDIO and, on Android 12+, the Bluetooth permissions at runtime before a call, and send users to the overlay settings screen for SYSTEM_ALERT_WINDOW. See Required Permissions.

Does the chat page load from my host?

No. The chat WebView always loads EnableX's hosted web client; your host, botId and path are passed to it over the JS bridge, and the web client calls your host. A WebView load error is therefore about reaching EnableX, not your host.

Which listener should I implement?

EnxChatBotListener if you only need “connected” and “closed”; EnxChatSessionListener (or EnxChatSessionListenerAdapter from Java) for messages, typing, state changes, calls and errors. You can use both. Set listeners before start() — see Known Limitations.

Does the chat survive screen rotation?

Yes. EnxChatClient saves and restores the WebView state across configuration changes.

Can I upgrade Enx_UIKit_Android on my own?

Only by replacing the vendored .aar, re-checking the merged manifest and re-testing both call paths. See Dependency Chain.