Skip to main content

Overview

CometChat’s Calls feature is an advanced functionality that allows you to seamlessly integrate one-on-one as well as group audio and video calling capabilities into your application. This document provides a technical overview of these features, as implemented in the Android UI Kit.

Integration

First, make sure that you’ve correctly integrated the UI Kit library into your project. If you haven’t done this yet or are facing difficulties, refer to our Getting Started guide. This guide will walk you through a step-by-step process of integrating our UI Kit into your Android project. Once you’ve successfully integrated the UI Kit, the next step is to add the CometChat Calls SDK to your project. This is necessary to enable the calling features in the UI Kit.

Step 1: Add Calls SDK Dependency

Add the following dependency to your build.gradle file:
dependencies {
  implementation 'com.cometchat:calls-sdk-android:4.+.+'
}
After adding this dependency, sync your project. The Android UI Kit will automatically detect the Calls SDK and activate the calling features.

Step 2: Verify Call Buttons Appear

Once the Calls SDK is integrated, you will see the CallButtons component automatically rendered in the MessageHeader component. This provides users with quick access to initiate audio and video calls.

Step 3: Add Call Listener for Incoming Calls

To receive incoming calls globally in your app, you will need to add a CallListener. This should be added before you initialize the CometChat UI Kit. We recommend creating a custom Application class and adding the call listener there. When an incoming call is received, you can display the CometChatIncomingCall component using the current activity context.
public class BaseApplication extends Application {

    private static final String LISTENER_ID = BaseApplication.class.getSimpleName() + System.currentTimeMillis();

    @Override
    public void onCreate() {
        super.onCreate();
        
        CometChat.addCallListener(LISTENER_ID, new CometChat.CallListener() {
            @Override
            public void onIncomingCallReceived(Call call) {
                // Get the current activity context
                Activity currentActivity = getCurrentActivity(); // Implement this method
                
                if (currentActivity != null) {
                    // Create and display the incoming call component
                    CometChatIncomingCall incomingCallView = new CometChatIncomingCall(currentActivity);
                    incomingCallView.setCall(call);
                    incomingCallView.setFitsSystemWindows(true);
                    
                    // Display the component (e.g., as dialog or snackbar)
                }
            }

            @Override
            public void onOutgoingCallAccepted(Call call) {
                // Handle outgoing call acceptance
            }

            @Override
            public void onOutgoingCallRejected(Call call) {
                // Handle outgoing call rejection
            }

            @Override
            public void onIncomingCallCancelled(Call call) {
                // Handle incoming call cancellation
            }
        });
    }
}

Call Components

The CometChat Android UI Kit provides four main components for implementing calling features in your app. Each component handles a specific part of the calling experience.

Call Buttons

The Call Buttons component provides users with quick access to initiate audio and video calls. This component is automatically rendered in the MessageHeader when the Calls SDK is integrated.
Learn more about Call Buttons →

Incoming Call

The Incoming Call component displays when a user receives an incoming call. It provides a full-screen interface showing caller information and call controls.
Learn more about Incoming Call →

Outgoing Call

The Outgoing Call component manages the outgoing call experience. It displays while waiting for the recipient to answer and automatically transitions to the active call screen once accepted.
Learn more about Outgoing Call →

Call Logs

The Call Logs component displays a history of all call activities, including missed, received, and dialed calls. Users can view call details and initiate new calls from the log.
Learn more about Call Logs →

Call Log Details

For detailed information about individual calls, including participants, join/leave history, and recordings, see the Call Log Details guide.

Troubleshooting

Call Buttons Not Appearing

If the call buttons don’t appear in the MessageHeader:
  1. Verify Calls SDK is added - Check that com.cometchat:calls-sdk-android:4.+.+ is in your build.gradle
  2. Sync Gradle - Make sure you’ve synced your project after adding the dependency
  3. Check UI Kit version - Ensure you’re using CometChat UI Kit v5 or later
  4. Verify initialization - Confirm CometChat is properly initialized before loading the UI

Incoming Calls Not Showing

If incoming calls aren’t displaying:
  1. Check CallListener registration - Ensure CometChat.addCallListener() is called in your Application class
  2. Verify Application class - Confirm your custom Application class is registered in AndroidManifest.xml
  3. Test listener ID - Make sure the listener ID is unique and not being removed elsewhere