> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-llms-indexes.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Calling Integration

> Add voice and video calling to your Android UI Kit application using chatuikit-kotlin or chatuikit-jetpack.

## Overview

This guide walks you through adding voice and video calling capabilities to your Android application using the CometChat UI Kit.

<Info>
  Make sure you've completed the [Getting Started](/ui-kit/android/getting-started) guide before proceeding.
</Info>

<Warning>
  **`enableCalling: true` makes the Calls SDK dependency mandatory — otherwise the app crashes at
  launch.** With the flag set, `CometChatUIKit.initFromSettings()` calls `initCometChatCalls()`, which
  throws if `com.cometchat:calls-sdk-android` is absent:

  ```
  java.lang.NoClassDefFoundError: Failed resolution of:
    Lcom/cometchat/calls/core/CometChatCalls$SessionSettingsBuilder;
      at com.cometchat.uikit.core.CometChatUIKit.initCometChatCalls(CometChatUIKit.kt:229)
  ```

  The crash happens in `onCreate`, **before any UI renders** — the flag name gives no hint that a
  dependency is implied. Change the flag and the dependency together, or leave `enableCalling` as
  `false` in an app that does not use calling.
</Warning>

## Add the Calls SDK

Add the CometChat Calls SDK dependency alongside your chosen UI Kit module:

<Tabs>
  <Tab title="Kotlin (XML Views)">
    ```kotlin build.gradle.kts theme={null}
    dependencies {
        implementation("com.cometchat:chatuikit-kotlin-android:6.0.3")
        implementation("com.cometchat:calls-sdk-android:5.0.1")
    }
    ```
  </Tab>

  <Tab title="Jetpack Compose">
    ```kotlin build.gradle.kts theme={null}
    dependencies {
        implementation("com.cometchat:chatuikit-compose-android:6.0.3")
        implementation("com.cometchat:calls-sdk-android:5.0.1")
    }
    ```
  </Tab>
</Tabs>

After adding this dependency, the Android UI Kit will automatically detect it and activate the calling features. You will see the `CometChatCallButtons` component rendered in the [MessageHeader](/ui-kit/android/message-header) component.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-android-llms-indexes/Ium2cs0uuq1JaKcY/images/81959c4b-Calling-ee689247c8cdd512c520b85f30683ad8.png?fit=max&auto=format&n=Ium2cs0uuq1JaKcY&q=85&s=4a136973bb1000ad86afa21a6f8282f2" width="1440" height="833" data-path="images/81959c4b-Calling-ee689247c8cdd512c520b85f30683ad8.png" />
</Frame>

## Set Up Call Listener

To receive incoming calls globally in your app, add a `CallListener` before initializing the CometChat UI Kit. We recommend creating a custom Application class:

<Tabs>
  <Tab title="Kotlin (XML Views)">
    ```kotlin theme={null}
    class BaseApplication : Application() {
        companion object {
            private val LISTENER_ID = "${BaseApplication::class.java.simpleName}${System.currentTimeMillis()}"
        }

        override fun onCreate() {
            super.onCreate()
            CometChat.addCallListener(LISTENER_ID, object : CometChat.CallListener {
                override fun onIncomingCallReceived(call: Call) {
                    // Get the current activity context
                    val currentActivity = getCurrentActivity() // Implement this method

                    currentActivity?.let {
                        val incomingCallView = CometChatIncomingCall(it)
                        incomingCallView.call = call
                        incomingCallView.fitsSystemWindows = true
                        incomingCallView.onError = OnError { exception ->
                            // Handle errors
                        }

                        // Display the component (e.g., as dialog or full-screen overlay)
                    }
                }

                override fun onOutgoingCallAccepted(call: Call) {
                    // Handle accepted outgoing call
                }

                override fun onOutgoingCallRejected(call: Call) {
                    // Handle rejected outgoing call
                }

                override fun onIncomingCallCancelled(call: Call) {
                    // Handle cancelled incoming call
                }
            })
        }
    }
    ```
  </Tab>

  <Tab title="Jetpack Compose">
    ```kotlin theme={null}
    class BaseApplication : Application() {
        companion object {
            private val LISTENER_ID = "${BaseApplication::class.java.simpleName}${System.currentTimeMillis()}"
        }

        override fun onCreate() {
            super.onCreate()
            CometChat.addCallListener(LISTENER_ID, object : CometChat.CallListener {
                override fun onIncomingCallReceived(call: Call) {
                    CometChatCallActivity.launchIncomingCallScreen(this@BaseApplication, call, null)
                    // Pass null or IncomingCallConfiguration if need to configure CometChatIncomingCall component
                }

                override fun onOutgoingCallAccepted(call: Call) {
                    // Handle accepted outgoing call
                }

                override fun onOutgoingCallRejected(call: Call) {
                    // Handle rejected outgoing call
                }

                override fun onIncomingCallCancelled(call: Call) {
                    // Handle cancelled incoming call
                }
            })
        }
    }
    ```
  </Tab>
</Tabs>
