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

# Overview

> Overview of Overview in CometChat.

The CometChat Kotlin Chat UI Kit lets Android developers integrate fully featured text chat & voice/video calling into mobile apps seamlessly.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-audit-content-webhooks/_FJLMq1zvjiq9K4Y/images/123a45a3-1623199936-38ff7714668d4876c04906702164dc7d.png?fit=max&auto=format&n=_FJLMq1zvjiq9K4Y&q=85&s=aa8aba160e33bf3bc6000d5f2b802b1d" width="652" height="268" data-path="images/123a45a3-1623199936-38ff7714668d4876c04906702164dc7d.png" />
</Frame>

<Tip>
  Improvements in v3.0

  * Faster connection & response times
  * Higher rate limits
  * Supports up to 100K users in a group
  * Unlimited groups
  * Support for Transient Messages
  * Real-time user & group members count And more!
</Tip>

The Kotlin Chat UI Kit’s fully customizable UI components simplify the process of integrating text chat and voice/video calling features to your Android mobile application.

<CardGroup>
  <Card title="I want to checkout Android Kotlin UI Kit.">
    Follow the steps mentioned in the `README.md` file.

    Kindly, click on below button to download our Android Kotlin Chat UI Kit.

    [Kotlin Chat UI Kit](https://github.com/cometchat/cometchat-uikit-android/tree/v3)

    [View on Github](https://github.com/cometchat/cometchat-uikit-android/tree/v3)
  </Card>

  <Card title="I want to explore sample apps.">
    Import the app into Android Studio and follow the steps mentioned in the `README.md` file.

    Kindly, click on below button to download our Java Sample App.

    [Kotlin Sample App](https://github.com/cometchat-pro/android-kotlin-chat-app/archive/v3.zip)

    [View on Github](https://github.com/cometchat-pro/android-kotlin-chat-app/tree/v3)
  </Card>
</CardGroup>

## **Prerequisites** ⭐

Before you begin, ensure you have met the following requirements:

✅ You have Android Studio installed on your machine.

✅ You have an Android Device or Emulator with Android Version 6.0 or above.

✅ You have read [Key Concepts](/ui-kit/kotlin/key-concepts).

## **Installing Android Kotlin Chat UI Kit**

### **Setup** 🔧

To install Android Kotlin UI Kit, you need to first register on CometChat Dashboard. [Click here to sign up.](https://app.cometchat.com/login)

#### **Get your Application Keys** 🔑

* Create a new app
* Head over to the Quick Start or API & Auth Keys section and note the App ID, Auth Key, and Region.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-audit-content-webhooks/cD2BDn03AOl0XRHO/images/0052b086-1631609323-06b4f0f4b8570ca81cc5a0de591c1892.jpg?fit=max&auto=format&n=cD2BDn03AOl0XRHO&q=85&s=6175d54ec9ac9c004e0b1c3f12eac751" width="973" height="375" data-path="images/0052b086-1631609323-06b4f0f4b8570ca81cc5a0de591c1892.jpg" />
</Frame>

#### **Add the CometChat Dependency**

First, add the repository URL to the **project level**`build.gradle` file in the repositories block under the `allprojects` section.

<Tabs>
  <Tab title="">
    ```gradle theme={null}
    allprojects {
      repositories {
        maven {
          url "https://dl.cloudsmith.io/public/cometchat/cometchat-pro-android/maven/"
        }
      }
    }
    ```
  </Tab>
</Tabs>

Open the **app level** `build.gradle` file and

1. Add the below two line in the `dependencies` section.

<Tabs>
  <Tab title="">
    ```gradle theme={null}
    dependencies {
      implementation 'com.cometchat:pro-android-chat-sdk:3.0.0'

    	/*v2.4+ onwards, Voice & Video Calling functionality has been
      moved to a separate library. In case you plan to use the calling feature,
      please add the Calling dependency*/

      implementation 'com.cometchat:pro-android-calls-sdk:2.1.0'
    }
    ```
  </Tab>
</Tabs>

2. Add the below lines `android` section

<Tabs>
  <Tab title="">
    ```gradle theme={null}
    android {
      compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
      }
    }
    ```
  </Tab>
</Tabs>

You can refer to the below link for instructions on how to do so:

**[📝 Add CometChat Dependency](/sdk/android/setup)** `Documentation`

### **Configure CometChat inside your app**

#### **Initialize CometChat** 🌟

The `init()` method initializes the settings required for CometChat. Please make sure to call this method before calling any other methods from CometChat SDK.

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    private val appID = "APP_ID"
    private val region = "REGION"
    val appSettings = AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build()

    CometChat.init(this, appID, appSettings, object : CallbackListener<String>() {
        override fun onSuccess(successMessage: String) {
            Log.d(TAG, "Initialization completed successfully")
        }

        override fun onError(e: CometChatException) {
            Log.d(TAG, "Initialization failed with exception: "+e.message)
        }
    })
    ```
  </Tab>
</Tabs>

<Warning>
  Make sure you replace the APP\_ID with your CometChat APP ID and REGION with your app's REGION in the above code.
</Warning>

#### **Login User** 👤

The `login()` method returns the User object containing all the information of the logged-in user.

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    private val UID = "cometchat-uid-1" // Replace with the UID of the user to login
    private val AUTH_KEY = "Enter AUTH_KEY" // Replace with your App Auth Key
    CometChat.login(UID, AUTH_KEY, object : CallbackListener<User?>() {
        override fun onSuccess(user: User?) {
            Log.d(TAG, "Login Successful : "+user.toString())
        }

        override fun onError(e: CometChatException) {
            Log.d(TAG, "Login failed with exception: " + e.message);
        }
    })
    ```
  </Tab>
</Tabs>

<Warning>
  Make sure you replace the AUTH\_KEY with your CometChat AUTH Key in the above code. We have setup 5 users for testing having UIDs: cometchat-uid-1, cometchat-uid-2, cometchat-uid-3, cometchat-uid-4 and cometchat-uid-5.
</Warning>

### **Add the Android Kotlin UI Kit Library**

To integrate the UI Kit, please follow the steps below:

* Clone the UI Kit-Kotlin Library from the [android-kotlin-chat-ui-kit](https://github.com/cometchat/cometchat-uikit-android/tree/v3) repository

[Kotlin Download Kotlin UI Kit Library](https://github.com/cometchat/cometchat-uikit-android/tree/v3)

* Import `uikit-kotlin` Module from Module Settings
* If the Library is added successfully, it will look like mentioned in the below image.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-audit-content-webhooks/0zf0AzyXRy6UbTAi/images/ef584b9f-1623199940-3ce2cb166efbbde43d01b53f7efe55ad.png?fit=max&auto=format&n=0zf0AzyXRy6UbTAi&q=85&s=cede29840c56fbe8263b4141b7ce9276" width="462" height="511" data-path="images/ef584b9f-1623199940-3ce2cb166efbbde43d01b53f7efe55ad.png" />
</Frame>

### **Configure Kotlin UI Kit Library**

To use UI Kit you have to add Material Design support in your app as the UI Kit uses Material Design Components.

* Add Material Design Dependency in build.gradle

<Tabs>
  <Tab title="build.gradle (app level)">
    ```gradle theme={null}
    dependencies {
        implementation 'com.google.android.material:material:<version>'
    }
    ```
  </Tab>
</Tabs>

* Make sure that your app's theme should extend `Theme.MaterialComponents`. Follow the guide on [Getting started Material Components](https://material.io/develop/android/docs/getting-started/)

The following is the list of Material Components themes you can use to get the latest component styles and theme-level attributes.

* `Theme.MaterialComponents.NoActionBar`
* Theme.MaterialComponents.Light.NoActionBar
* Theme.MaterialComponents.DayNight.NoActionBar

Update your app theme to inherit from one of these themes, e.g.:

<Tabs>
  <Tab title="xml">
    ```xml theme={null}
    <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">

    <!-- Customize your theme here. -->
    </style>
    ```
  </Tab>
</Tabs>

<Warning>
  Enable DataBinding

  As the UI Kit uses DataBinding you must enable DataBinding
</Warning>

To configure your app to use data binding, add the dataBinding element to your `build.gradle` file in the app module, as shown in the following example:

<Tabs>
  <Tab title="build.gradle (app level)">
    ```gradle theme={null}
    android {
        dataBinding {
            enabled = true
        }
    }
    ```
  </Tab>
</Tabs>

<Warning>
  important

  We are using File Provider for storage & file access. So you need to add your application package name in manifestPlaceholders
</Warning>

<Tabs>
  <Tab title="build.gradle (app level)">
    ```gradle theme={null}
    android {
    		defaultConfig {
    			...

    			manifestPlaceholders = [file_provider: "YOUR_PACKAGE_NAME"]
    			//add your application package.
    		}
    	}
    ```
  </Tab>
</Tabs>

### **Launch CometChatUI** 🚀

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-audit-content-webhooks/cD2BDn03AOl0XRHO/images/0437adc6-1631610279-04b3c972f9c490f7796108e5e16fbb60.png?fit=max&auto=format&n=cD2BDn03AOl0XRHO&q=85&s=4eb6abbb5b9b57510af6baf127f35de4" width="4260" height="2800" data-path="images/0437adc6-1631610279-04b3c972f9c490f7796108e5e16fbb60.png" />
</Frame>

**CometChatUI** is an option to launch a fully functional chat application using the UI Kit. In UI Kit all the UI Components are interlinked and work together to launch a fully functional chat on your mobile/application.

To use CometChatUI user has to launch CometChatUI Activity. Add the following code snippet to launch `CometChatUI`.

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    startActivity(Intent(this@YourActivity, CometChatUI::class.java))
    ```
  </Tab>
</Tabs>

## **See our Kotlin chat sample app**

Visit our [Kotlin chat app](https://github.com/cometchat-pro/android-kotlin-chat-app) repository to run a sample app and see the UI Kit in action.
