Skip to main content

Overview

With calling enabled, the UI Kit places calls from the message header and call logs, shows the outgoing call screen, and hosts the in-call screen. Incoming calls ring through the CometChat Push Notifications SDK: it shows the call notification and the full-screen incoming-call screen, plays the ringtone, and opens your answer activity when the user answers, which hands the call to the UI Kit’s call screen, with the app in the foreground, in the background or not running at all.
Make sure you’ve completed the Getting Started guide before proceeding.
What you write: the UI Kit settings with calling enabled, the Push SDK configuration, a small answer activity, a three-line Firebase service, and the manifest permissions. There is no call listener to register and no incoming-call UI to show.

Step 1: Dependencies

The UI Kit does not bundle the Calls SDK: calls-sdk-android is a compile-only dependency of the kit, so your app declares it. Add the UI Kit module, the Calls SDK, the two Push Notifications SDK artifacts and Firebase Messaging. List the UI Kit before the Push SDK artifacts, so the UI Kit’s incoming-call colours take effect (see Styling the incoming-call screen):
build.gradle.kts
Apply the google-services plugin and put google-services.json in the app module. minSdk must be 28 or higher, the UI Kit’s minimum.
setEnableCalling(true) and the calls-sdk-android artifact are a pair. UI Kit 6.2.0 checks for the Calls SDK during init: with the flag on and the artifact missing it logs enableCalling=true but the CometChat Calls SDK is not on the classpath; skipping Calls init, finishes chat init without calling. The calling components then fail quietly, each with its own Calls SDK is not on the classpath warning in logcat: Call Logs shows an empty list, the call buttons fail with CALLS_SDK_MISSING, and the call screen does not start. UI Kits before 6.2.0 crashed at launch with NoClassDefFoundError instead. The UI Kit requires calls-sdk-android 5.1 or newer and push-notifications-android / push-notifications-calls-android 2.0 or newer.

Step 2: Enable calling in the UI Kit

Set setEnableCalling(true) in UIKitSettings. CometChatUIKit.init then initialises the Calls SDK with the same app id, region and hosts, and CometChatUIKit.login logs the user into it. Do not call CometChatCalls.init yourself: the Calls SDK keeps the hosts of its first initialisation.
Run this in Application.onCreate from stored credentials, not only after a screen opens. A push can start the app process to ring a call, and the answer must find a ready SDK.
Enabling calling in an app that already has logged-in users requires a re-login. CometChatUIKit.login() short-circuits when the same uid already has a persisted session, so the Calls SDK never logs in: the Calls SDK has no auth token and CometChatCallLogs shows a silent error state (logcat: User auth token cannot be null). After calling is first enabled, log out and log in again (CometChatUIKit.logout(...) then CometChatUIKit.login(...)), and wire onError on CometChatCallLogs during development so this failure is visible.

Step 3: Configure push ringing

Initialise the Push Notifications SDK once, after the UI Kit. It needs the FCM provider id and an answer activity: the screen the Push SDK opens when the user taps Answer.
The UI Kit does not depend on the Push SDK, so the answer activity is a small class in your app. It reads the answered call from its intent, opens the UI Kit’s call screen with it, and finishes:
AndroidManifest.xml
Then hand every push to the SDK from your Firebase service:
AndroidManifest.xml
The push token is registered on login and unregistered on logout by the SDK. Do not skip call pushes when the app is in the foreground: the push is the only incoming-call signal, in every app state. Call pushes must be sent at high FCM priority. To colour the incoming-call screen with your UI Kit theme, see Styling the incoming-call screen. The other PNConfiguration options (ring timeout, missed-call notifications, your own ring screen) are on the Calls SDK’s Push Ringing page.

Step 4: Permissions

There is nothing to declare. RECORD_AUDIO, CAMERA and POST_NOTIFICATIONS merge into your manifest from the UI Kit, the Calls SDK and the Push SDK’s calls module, along with the permissions ringing needs. You only request them at runtime:
  • Notifications: after sign-in, call CometChatPushNotifications.ensureRingReady(activity) { result -> … } (snippet below) and show the user any RingReadiness other than READY. On Android 13+ it asks for POST_NOTIFICATIONS itself when it is missing, and reports NOTIFICATIONS_OFF while that prompt is still on screen. Notifications off, a muted call channel, a revoked full-screen intent and Do Not Disturb all silence calls with no error.
  • Microphone and camera: the Push SDK asks when the user answers, and the UI Kit’s call screen asks once more when it opens; a denied microphone joins muted. Ask at sign-in as well if you do not want the first call to be where the user meets the prompt.
If your app asks for other permissions at sign-in, call ensureRingReady after those requests have returned; Android drops a permission request made while another dialog is open.

Step 5: Log out through the UI Kit

CometChatUIKit.logout ends a call in progress, cancels an outgoing call still ringing, then logs out of the Chat SDK and the Calls SDK; the Push SDK stops a ring still playing for the old user and unregisters the token. CometChat.logout alone does none of the calling clean-up.

What the UI Kit does from here

Once calling is active, the voice and video call buttons render in the MessageHeader:
The call buttons appear automatically — CometChatMessageHeader detects that calling is enabled, so no extra code is needed.
To react to calls in your own code (a badge, analytics, refreshing a screen), listen on the Calls SDK with CometChatCalls.addIncomingCallListener, the same callback the UI Kit uses internally. Do not use the Chat SDK’s CallListener; it is superseded and fires nothing in this flow.

Placing a call from your own screen

CometChatCallActivity is com.cometchat.uikit.kotlin.calls.CometChatCallActivity for XML Views and com.cometchat.uikit.compose.calls.CometChatCallActivity for Compose. initiateUserCall fails with CALL_IN_PROGRESS while another start is in flight; it does not check for a call already in progress, so do that yourself, or use Call Buttons, which refuse with ACTIVE_CALL while another session is active.

Styling the incoming-call screen

The incoming-call screen belongs to the Push SDK, which draws it even when your app is not running, so it cannot read the UI Kit theme at that moment. Instead you pass it your UI Kit theme once, as a CometChatPNIncomingCallTheme, when you initialise push. Light and dark are both included, and the screen and the call notifications then follow your theme. The UI Kit reads its own theme into a CometChatIncomingCallTheme:
The UI Kit has no dependency on the Push SDK, so a small function in your app copies the colours across. The field names match one to one:
calls/IncomingCallTheme.kt
Then add one line to the configuration from Step 3:
If your app changes its UI Kit colours while running, pass the new theme with CometChatPushNotifications.setIncomingCallTheme(context, theme). Each field comes from one UI Kit colour: Without this line, the screen still uses the UI Kit’s default colours. The UI Kit overrides the cometchat_pn_call_* colour resources with its light and dark palette at build time. Those overrides win over the Push SDK’s defaults only when your app lists the UI Kit dependency before the Push SDK artifacts. Your app’s own overrides always win. To change a single colour, override its resource, or chain any CometChatPNIncomingCallTheme.Colors.Builder setter after mapping. The full list of colours, strings, drawables and the layout is under Theming the SDK’s incoming-call screen. To draw the screen yourself, register your own activity with setIncomingCallActivity, for example one that hosts the deprecated Incoming Call component. The UI Kit’s CometChatCallActivity does not work there: it does not read the call the Push SDK passes in its intent, so it would open empty.

Upgrading from an app that used CometChat.addCallListener

Remove the Application-level CallListener, the incoming-call overlay or launchIncomingCallScreen call, any ringtone you played, the busy check, and the Push SDK 1.0 setVoIPEnabled / setOnCallAnsweredHandler wiring, and follow the steps above. The method-by-method mapping is on Migrating from Legacy Ringing.