Getting Started with CometChat Android UI Kit
The CometChat UI Kit for Android streamlines the integration of in-app chat functionality by providing a comprehensive set of prebuilt UI components. It offers seamless theming options, including light and dark modes, customizable fonts, colors, and extensive styling capabilities.
With built-in support for one-to-one and group conversations, developers can efficiently enable chat features within their applications. Follow this guide to quickly integrate chat functionality using the CometChat Android UI Kit.

Prerequisitesβ
Before installing the CometChat UI Kit for Android, you must first create a CometChat application via the CometChat Dashboard. The dashboard provides all the essential chat service components, including:
- User Management
- Group Chat & Messaging
- Voice & Video Calling
- Real-time Notifications
To initialize the UI Kit, you will need the following credentials from your CometChat application:
- App ID
- Auth Key
- Region
Ensure you have these details ready before proceeding with the installation and configuration.
Register & Set Up CometChatβ
Follow these steps to register on CometChat and set up your development environment.
Step 1: Register on CometChatβ
To use CometChat UI Kit, you first need to register on the CometChat Dashboard.
Step 2: Get Your Application Keysβ
After registering, create a new app and retrieve your authentication details:
- Navigate to Application, then select the Credentials section.
- Note down the following keys:
- App ID
- Auth Key
- Region
Each CometChat application can be integrated with a single client app. Users within the same application can communicate across multiple platforms, including web and mobile.
Step 3: Set Up Your Development Environmentβ
Ensure your system meets the following prerequisites before proceeding with integration.
System Requirements:
- Android Studio installed on your machine.
- An Android emulator or physical device running Android 6.0 or higher.
- Java 8 or higher installed.
- Gradle plugin 4.0.1 or later installed.
Getting Startedβ
Step 1: Create an Android Projectβ
- Open Android Studio and start a new project.
- Choose Empty Activity as the project template.
- Enter a project name and choose Java or Kotlin as the language.
- Set minimum API level to 21 or higher.
Step 2: Install Dependenciesβ
To integrate CometChat into your Android project, add the required dependencies to your Gradle configuration.
i. Add the CometChat Repositoryβ
To integrate CometChat into your Android project, you need to add the CometChat repository to your project-level settings.gradle
or settings.gradle.kts
file. Follow the steps below based on your project configuration.
- Kotlin
- Groovy
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://dl.cloudsmith.io/public/cometchat/cometchat/maven/")
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven{
url "https://dl.cloudsmith.io/public/cometchat/cometchat/maven/"
}
}
}
ii. Add the CometChat Dependencyβ
- Version Catalog (libs.versions.toml)
- Gradle (build.gradle)
Inside libs.versions.toml
, add the CometChat Chat UI Kit version under the [versions]
section:
[versions]
cometchat-ui-kit = "5.0.2"
cometchat-calls-sdk = "4.1.0"
Under the [libraries]
section, define the library and reference the version:
[libraries]
cometchat-ui-kit = { module = "com.cometchat:chat-uikit-android", version.ref = "cometchat-ui-kit" }
cometchat-calls-sdk = { module = "com.cometchat:calls-sdk-android", version.ref = "cometchat-calls-sdk" }
Now, in your app-level build.gradle.kts
file, add the dependency using libs from Version Catalogs:
dependencies {
implementation(libs.cometchat.ui.kit)
// (Optional) Include if using voice/video calling features
implementation(libs.cometchat.calls.sdk)
}
Open the app level build.gradle
file and add the following dependency to fetch the chat UI kit into your project.
dependencies {
// CometChat UIKit
implementation 'com.cometchat:chat-uikit-android:5.0.2'
// (Optional) Include this if your app uses voice/video calling features
implementation 'com.cometchat:calls-sdk-android:4.1.0'
}
iii. Add AndroidX Supportβ
The Jetifier tool helps migrate legacy support libraries to AndroidX.
Open the gradle.properties file and verify if the specified line is present. If not, add it accordingly.
android.enableJetifier=true
Step 3: Initialize & Login to CometChat UI Kitβ
To authenticate a user, you need a UID
. You can either:
-
Create new users on the CometChat Dashboard, CometChat SDK Method or via the API.
-
Use pre-generated test users:
cometchat-uid-1
cometchat-uid-2
cometchat-uid-3
cometchat-uid-4
cometchat-uid-5
The Login method returns a User object containing all relevant details of the logged-in user.
The Auth Key is an optional property of the UIKitSettings
class. It is primarily recommended for proof-of-concept (POC) development or early-stage application development.
For secure authentication, use the Auth Token
method instead.
Security Best Practices
- The Auth Key method is recommended for proof-of-concept (POC) development and early-stage testing.
- For production environments, it is strongly advised to use an Auth Token instead of an Auth Key to enhance security and prevent unauthorized access.
- Kotlin
- Java
import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.enableEdgeToEdge
import com.cometchat.chat.core.CometChat
import com.cometchat.chat.exceptions.CometChatException
import com.cometchat.chat.models.User
import com.cometchat.chatuikit.shared.cometchatuikit.CometChatUIKit
import com.cometchat.chatuikit.shared.cometchatuikit.UIKitSettings
class MainActivity : ComponentActivity() {
private val TAG = "MainActivity"
private val appID = "APP_ID" // Replace with your App ID
private val region = "REGION" // Replace with your App Region
private val authKey = "AUTH_KEY" // Replace with your Auth Key or leave blank if you are authenticating using Auth Token
private val uiKitSettings = UIKitSettings.UIKitSettingsBuilder()
.setRegion(region)
.setAppId(appID)
.setAuthKey(authKey)
.subscribePresenceForAllUsers()
.build()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
CometChatUIKit.init(this, uiKitSettings, object : CometChat.CallbackListener<String?>() {
override fun onSuccess(successString: String?) {
Log.d(TAG, "Initialization completed successfully")
loginUser()
}
override fun onError(e: CometChatException?) {}
})
}
private fun loginUser() {
CometChatUIKit.login("cometchat-uid-1", object : CometChat.CallbackListener<User>() {
override fun onSuccess(user: User) {
// β
Option 1: Launch One-to-One or Group Chat Screen
// val intent = Intent(this@MainActivity, MessageActivity::class.java)
// intent.putExtra("uid", "cometchat-uid-1")
// startActivity(intent)
// β
Option 2: Launch Conversation List + Message View (Split-Screen Style)
// startActivity(Intent(this@MainActivity, ConversationActivity::class.java))
// β
Option 3: Launch Tab-Based Chat Experience (Chats, Calls, Users, Groups)
// startActivity(Intent(this@MainActivity, TabbedActivity::class.java))
}
override fun onError(e: CometChatException) {
// Handle login failure (e.g. show error message or retry)
Log.e("Login", "Login failed: ${e.message}")
}
})
}
}
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import androidx.activity.ComponentActivity;
import com.cometchat.chat.core.CometChat;
import com.cometchat.chat.exceptions.CometChatException;
import com.cometchat.chat.models.User;
import com.cometchat.chatuikit.shared.cometchatuikit.CometChatUIKit;
import com.cometchat.chatuikit.shared.cometchatuikit.UIKitSettings;
public class MainActivity extends ComponentActivity {
private static final String TAG = "MainActivity";
private final String appID = "APP_ID"; // Replace with your App ID
private final String region = "REGION"; // Replace with your App Region
private final String authKey = "AUTH_KEY"; // Replace with your Auth Key
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setDecorFitsSystemWindows(false); // Equivalent to enableEdgeToEdge()
UIKitSettings uiKitSettings = new UIKitSettings.UIKitSettingsBuilder()
.setRegion(region)
.setAppId(appID)
.setAuthKey(authKey)
.subscribePresenceForAllUsers()
.build();
CometChatUIKit.init(this, uiKitSettings, new CometChat.CallbackListener<String>() {
@Override
public void onSuccess(String success) {
Log.d(TAG, "Initialization completed successfully");
loginUser();
}
@Override
public void onError(CometChatException e) {
Log.e(TAG, "Initialization failed: " + (e != null ? e.getMessage() : "Unknown error"));
}
});
}
private void loginUser() {
CometChatUIKit.login("cometchat-uid-1", new CometChat.CallbackListener<User>() {
@Override
public void onSuccess(User user) {
Log.d(TAG, "Login successful for user: " + user.getUid());
// β
Option 1: Launch One-to-One or Group Chat Screen
// Intent intent = new Intent(MainActivity.this, MessageActivity.class);
// intent.putExtra("uid", "cometchat-uid-1");
// startActivity(intent);
// β
Option 2: Launch Conversation List + Message View
// startActivity(new Intent(MainActivity.this, ConversationActivity.class));
// β
Option 3: Launch Tab-Based Chat Experience (Chats, Calls, Users, Groups)
// startActivity(new Intent(MainActivity.this, TabbedActivity.class));
}
@Override
public void onError(CometChatException e) {
Log.e("Login", "Login failed: " + (e != null ? e.getMessage() : "Unknown error"));
}
});
}
}
Ensure you replace the following placeholders with your actual CometChat credentials:
- APP_ID β Your CometChat App ID
- AUTH_KEY β Your CometChat Auth Key
- REGION β Your App Region
These values are required for proper authentication and seamless integration.
Step 4: Set Up Global Themeβ
To customize component styling across your application in one place, you need to set up the CometChat Theme.
Use the CometChatTheme.DayNight
style, which is built on Theme.MaterialComponents.DayNight.NoActionBar
.
Apply the Theme
Set CometChatTheme.DayNight
as the parent theme for your application in the themes.xml
file.
<style name="YourAppParentTheme" parent="CometChatTheme.DayNight"/>
<application
android:theme="@style/YourAppParentTheme"
...
...
>
</application>
Step 5: Choose a Chat Experienceβ
Integrate a conversation view that suits your application's UX requirements. Below are the available options:
1οΈβ£ Conversation List + Message Viewβ
Best for: Android apps needing a fluid tap-to-open messaging experience while managing multiple conversations.
Highlights:
- Compact UI β Single-screen layout for mobile; tap a conversation to open the message view.
- One-to-One & Group Chats β Handle private and group conversations natively.
- Session Persistence β Messages and read states sync across devices.
- Real-Time Messaging β Seamless updates for both message view and conversation list.
- Smooth Navigation β Intuitive stack-based flow using
FragmentManager
or Jetpack Navigation. - Lightweight & performant β Designed for mobile responsiveness and low memory footprint.

Use When:
- You need mobile-friendly navigation between multiple chats.
- Your app supports both 1:1 and group messaging.
- You want a clean switch between list and message view without sidebars.
2οΈβ£ One-to-One / Group Chatβ
Best for: Use cases where users jump directly into a chat β no list, just the conversation.
Highlights:
- Single chat screen β Loads a specific user/group chat without navigating a list.
- Ideal for contextual use-cases β Support chats, direct messages, or contextual onboarding flows.
- Lightweight β Minimal UI, reduced code complexity.
- Full-screen messaging β Immersive, distraction-free conversation experience.
- Flexible setup β Accepts pre-fetched user/group object or ID for quick launch.

Use When:
- Your flow starts with a specific contact or ticket (e.g., customer support).
- You want a no-frills, clean chat screen.
- Perfect for helpdesks, dating apps, or onboarding flows.
3οΈβ£ Tab-Based Messaging UI (All-in-One)β
Best for: Android apps with multi-feature navigation like chats, calls, contacts, and settings β all from a single entry point.
Highlights:
- Bottom Navigation β Use Androidβs
BottomNavigationView
for fast switching between features. - Dedicated Fragments β Each tab (Chats, Calls, Users, Settings) has its own optimized view.
- No Sidebar β Mobile-first, stack-based design, ideal for small screens.
- Modular & Extensible β Add more tabs (e.g., Notifications, Favorites) as needed.
- Perfect for SuperApps β Unified chat, VoIP, and user management in one interface.
- Responsive Layouts β Adjusts to different screen sizes and orientations.

Use When:
- You want a multi-functional chat app in one interface.
- Your users need to navigate easily between modules.
- Ideal for support, enterprise, or social apps.
Build Your Own Chat Experienceβ
Best for: Developers who need complete control over their chat interface, allowing customization of components, themes, and features to align with their appβs design and functionality. Whether you're enhancing an existing chat experience or building from scratch, this approach provides the flexibility to tailor every aspect to your needs.
Recommended for:
- Apps that require a fully customized chat experience.
- Developers who want to extend functionalities and modify UI components.
- Businesses integrating chat seamlessly into existing platforms.
Key Areas to Explore:
- Android Sample App β Fully functional sample applications to accelerate your development.
- Core Features β Learn about messaging, real-time updates, and other essential capabilities.
- Components β Utilize prebuilt UI elements or customize them to fit your design.
- Themes β Adjust colors, fonts, and styles to match your branding.
- Build Your Own UI β Prefer a custom UI over our UI Kits? Explore our SDKs to create a tailored chat experience.
Next Stepsβ
Now that youβve selected your chat experience, proceed to the integration guide:
- Integrate Conversation List + Message
- Integrate One-to-One Chat
- Integrate Tab-Based Chat
- Advanced Customizations