WebView Kotlin

WebView Kotlin

LiveCaller Chat Widget Integration for Android

This guide explains how to integrate the LiveCaller Chat Widget into an Android app 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

6. WebView Configuration Extension

7. Load Chat Widget

8. Required Imports

Add these imports to your Activity file:

Last updated