WebView Kotlin

WebView Kotlin

Integration of LiveCaller Chat Widget for Android

This guide explains how to integrate the LiveCaller chat widget into an Android application using WebView.

Main Activity

package com.example.livecaller_integration

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.runtime.*
import com.example.livecaller_integration.ui.theme.LiveCallerTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            LiveCallerTheme {
                AppContent()
            }
        }
    }
}

@Composable
fun AppContent() {
    var currentScreen by remember { mutableStateOf("home") }

    when (currentScreen) {
        "home" -> HomeScreen { currentScreen = "chat" }
        "chat" -> ChatScreen { currentScreen = "home" }
    }
}

Home Screen


Chat Screen with WebView


WebView Configuration Extension


Loading the Chat Widget


Required Imports

Add the following imports to your Activity file:


Last updated