Skip to main content
🚀 CometChat Android SDK v5 is now available! It removes the Gson dependency, adds Parcelable support, and introduces structural equality. Try the v5 →
// 1. Add dependency to build.gradle
implementation "com.cometchat:chat-sdk-android:4.2.0"

// 2. Initialize (run once at app start)
val appSettings = AppSettings.AppSettingsBuilder()
    .subscribePresenceForAllUsers()
    .setRegion("REGION")
    .build()
CometChat.init(context, "APP_ID", appSettings, callback)

// 3. Login user
CometChat.login("UID", "AUTH_KEY", callback)  // Dev only
Required Credentials: App ID, Region, Auth Key (dev) or Auth Token (prod)
Get from: CometChat Dashboard → Your App → API & Auth Keys
CometChat.init() must be called before any other SDK method. Calling login(), sendMessage(), or registering listeners before init() will fail.
Auth Key is for development/testing only. In production, generate Auth Tokens on your server using the REST API and pass them to the client. Never expose Auth Keys in production client code.
This guide demonstrates how to add chat to an Android application. Before you begin, we strongly recommend reading the Key Concepts guide.

Requirements

RequirementMinimum Version
Android API Level21
Android API Level (with Calls SDK)24
Java8
AndroidXRequired

Getting Started

1

Get your credentials

Sign up for CometChat and create an app. Note your App ID, Region, and Auth Key from the Dashboard.
2

Install and initialize

Add the SDK to your project and initialize it with your credentials. See Setup SDK.
3

Authenticate users

Log in users with Auth Key (development) or Auth Token (production). See Authentication.
4

Start building

Send your first message, make a call, or manage users and groups.

Features

Messaging

1:1 and group chat, threads, reactions, typing indicators, read receipts, file sharing, and interactive messages.

Voice & Video Calling

Ringing flows, direct call sessions, standalone calling, recording, and screen sharing.

Users

Create, retrieve, and manage users. Track online/offline presence and block/unblock users.

Groups

Public, private, and password-protected groups with member management, roles, and ownership transfer.

Sample Apps

Import the app into Android Studio and follow the steps mentioned in the README.md file.

Java

Java sample app

Kotlin

Kotlin sample app

UI Kits

Refer to the Android UI Kit for pre-built, customizable components.

Resources

Key Concepts

UIDs, GUIDs, auth tokens, and core SDK concepts

Message Structure

Message categories, types, and hierarchy

Changelog

Latest SDK version and release notes

Upgrading from V3

Migration guide for V3 users

Publishing to Play Store

Steps to publish your Android app

Next Steps

Setup SDK

Detailed installation and initialization guide for the Android SDK

Key Concepts

Understand core concepts like users, groups, messages, and conversations

Authentication

Learn about secure authentication with Auth Tokens for production apps

Send Messages

Start sending text, media, and custom messages to users and groups