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

# Setup

> Set up CometChat Calls SDK v5 for Android with installation, app credentials, initialization, authentication, and a basic calling flow.

<Info>
  **Faster Integration with UI Kits**

  If you're using CometChat UI Kits, voice and video calling can be quickly integrated:

  * Incoming & outgoing call screens
  * Call buttons with one-tap calling
  * Call logs with history

  👉 [Android UI Kit Calling Integration](/ui-kit/android/calling-integration)

  Use this Calls SDK directly only if you need custom call UI or advanced control.
</Info>

This guide walks you through installing the CometChat Calls SDK and initializing it in your Android application.

## Add the CometChat Dependency

### Step 1: Add Repository

Add the CometChat repository URL to your **project level** `build.gradle` file in the `repositories` block:

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

  <Tab title="Kotlin DSL">
    ```kotlin theme={null}
    allprojects {
      repositories {
        maven {
          url = uri("https://dl.cloudsmith.io/public/cometchat/cometchat/maven/")
        }
      }
    }
    ```
  </Tab>
</Tabs>

### Step 2: Add Dependencies

Add the Calls SDK dependency to your **app level** `build.gradle` file:

<Tabs>
  <Tab title="Groovy">
    ```groovy theme={null}
    dependencies {
      implementation "com.cometchat:calls-sdk-android:5.0.4"

      // Required. The Calls SDK renders its call surface through an embedded React Native
      // runtime, and your app must initialize its native loader (Step 4) - which only
      // compiles if these two are on your compile classpath.
      implementation "com.facebook.react:react-android:0.77.2"
      implementation "com.facebook.soloader:soloader:0.12.1"
    }
    ```
  </Tab>

  <Tab title="Kotlin DSL">
    ```kotlin theme={null}
    dependencies {
      implementation("com.cometchat:calls-sdk-android:5.0.4")

      // Required. The Calls SDK renders its call surface through an embedded React Native
      // runtime, and your app must initialize its native loader (Step 4) - which only
      // compiles if these two are on your compile classpath.
      implementation("com.facebook.react:react-android:0.77.2")
      implementation("com.facebook.soloader:soloader:0.12.1")
    }
    ```
  </Tab>
</Tabs>

<Warning>
  **Set `minSdkVersion` to 26 or higher.** The Calls SDK's transitive dependencies declare `minSdk 26`, so a
  lower value fails the build at the manifest merger:
  `uses-sdk:minSdkVersion 24 cannot be smaller than version 26 declared in library [...react-native-svg...]`.
</Warning>

### Step 3: Configure Java Version

Add Java 8 compatibility to the `android` section of your **app level** `build.gradle`:

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

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

### Step 4: Initialize the Native Loader

**Required.** The Calls SDK renders its call surface through an embedded React Native runtime. React Native
0.76+ ships a single merged native library and resolves the individual library names through
`OpenSourceMergedSoMapping`, which must be registered with SoLoader **before** the first call surface is
created. Do it once, in your `Application.onCreate()`:

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    import android.app.Application
    import com.facebook.react.soloader.OpenSourceMergedSoMapping
    import com.facebook.soloader.SoLoader

    class MyApplication : Application() {
        override fun onCreate() {
            super.onCreate()
            SoLoader.init(this, OpenSourceMergedSoMapping)
            // ... CometChatCalls.init(...) can follow
        }
    }
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    import android.app.Application;
    import com.facebook.react.soloader.OpenSourceMergedSoMapping;
    import com.facebook.soloader.SoLoader;

    public class MyApplication extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            SoLoader.init(this, OpenSourceMergedSoMapping.INSTANCE);
            // ... CometChatCalls.init(...) can follow
        }
    }
    ```
  </Tab>
</Tabs>

Register the class in your `AndroidManifest.xml`:

```xml theme={null}
<application android:name=".MyApplication">
```

<Warning>
  Skipping this step does not fail the build - it crashes the app the first time a user joins a call:
  `java.lang.UnsatisfiedLinkError: dlopen failed: library "libhermes_executor.so" not found`
  (the exact library name varies by device). Verified on two emulators, API 36 and API 37.
</Warning>

<Note>
  **Why this step exists.** The SDK already performs this initialization internally, but only on the
  legacy `startSession()` path - it was not carried over to either `joinSession()` overload, which is
  the v5 API this guide uses. Until a future 5.0.x moves it, the app has to do it. Integrations still
  on `startSession()`, and some UI Kit setups, will not see the crash for that reason - do not rely on
  it, since the recommended v5 flow does not take that path.
</Note>

## Add Permissions

Add the required permissions to your `AndroidManifest.xml`:

```xml theme={null}
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```

<Note>
  For Android 6.0 (API level 23) and above, you must request camera and microphone permissions at runtime before starting a call.
</Note>

## Initialize CometChat Calls

The `init()` method initializes the SDK with your app credentials. Call this method once when your application starts, typically in your `Application` class or main `Activity`.

### CallAppSettings

The `CallAppSettings` class configures the SDK initialization:

| Parameter | Type   | Required | Description                    |
| --------- | ------ | -------- | ------------------------------ |
| `appId`   | String | Yes      | Your CometChat App ID          |
| `region`  | String | Yes      | Your app region (`us` or `eu`) |

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    import com.cometchat.calls.core.CometChatCalls
    import com.cometchat.calls.core.CallAppSettings

    val appId = "APP_ID" // Replace with your App ID
    val region = "REGION" // Replace with your Region ("us" or "eu")

    val callAppSettings = CallAppSettings.CallAppSettingBuilder(appId, region).build()

    CometChatCalls.init(this, callAppSettings, object : CometChatCalls.CallbackListener<String>() {
        override fun onSuccess(message: String) {
            Log.d(TAG, "CometChat Calls SDK initialized successfully")
        }

        override fun onError(e: CometChatException) {
            Log.e(TAG, "CometChat Calls SDK initialization failed: ${e.message}")
        }
    })
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    import com.cometchat.calls.core.CometChatCalls;
    import com.cometchat.calls.core.CallAppSettings;

    String appId = "APP_ID"; // Replace with your App ID
    String region = "REGION"; // Replace with your Region ("us" or "eu")

    CallAppSettings callAppSettings = new CallAppSettings.CallAppSettingBuilder(appId, region).build();

    CometChatCalls.init(this, callAppSettings, new CometChatCalls.CallbackListener<String>() {
        @Override
        public void onSuccess(String message) {
            Log.d(TAG, "CometChat Calls SDK initialized successfully");
        }

        @Override
        public void onError(CometChatException e) {
            Log.e(TAG, "CometChat Calls SDK initialization failed: " + e.getMessage());
        }
    });
    ```
  </Tab>
</Tabs>

| Parameter         | Description                                       |
| ----------------- | ------------------------------------------------- |
| `this`            | Android context (Application or Activity context) |
| `callAppSettings` | Configuration object with App ID and Region       |
| `listener`        | Callback listener for success/error handling      |

## Check Initialization Status

You can verify if the SDK has been initialized using the `isInitialized()` method:

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    if (CometChatCalls.isInitialized()) {
        // SDK is ready to use
    } else {
        // Initialize the SDK first
    }
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    if (CometChatCalls.isInitialized()) {
        // SDK is ready to use
    } else {
        // Initialize the SDK first
    }
    ```
  </Tab>
</Tabs>
