Skip to main content
Quick Reference for AI Agents & Developers
// Add dependency to build.gradle
implementation 'com.cometchat:calls-sdk-android:4.3.3'

// Initialize (run once at app start)
val callAppSettings = CallAppSettingBuilder()
    .setAppId("APP_ID")
    .setRegion("REGION")
    .build()

CometChatCalls.init(context, callAppSettings, object : CometChatCalls.CallbackListener<String>() {
    override fun onSuccess(s: String?) { }
    override fun onError(e: CometChatException) { }
})
Required Credentials: App ID, Region
Get from: CometChat Dashboard → Your App → API & Auth Keys

Get your Application Keys

Sign up for CometChat and then:
  1. Create a new app
  2. Head over to the API Keys section and note the Auth Key, App ID & Region
Minimum Requirement
  • Android API Level 21
  • Android API level 24 (in case you are using the calls SDKS)
  • Androidx Compatibility

Add the CometChatCalls Dependency

Gradle

First, add the repository URL to the project level build.gradle file in the repositories block under the allprojects section:
allprojects {
  repositories {
    maven {
        url "https://dl.cloudsmith.io/public/cometchat/cometchat/maven/"
    }
  }
}
Then, add CometChatCalls to the app level build.gradle file in the dependencies section.
dependencies {
  implementation 'com.cometchat:calls-sdk-android:4.3.3'
}

Initialize CometChatCalls

The init() method initializes the settings required for CometChatCalls. The init() method takes the following parameters:
  • context - Your activity context
  • callAppSettings - An object of the CallAppSettings class created using the CallAppSettingBuilder class. The appId and region fields are mandatory and can be set using the setAppId() and setRegion() methods.
The CallAppSettings class allows you to configure three settings:
  • App ID: CometChat app ID.
  • Region: The region where your app was created.
  • Host (host: string): This method takes the client URL as input and uses this client URL instead of the default client URL. This can be used in case of dedicated deployment of CometChat.
We recommend calling the init() method in the activity’s onCreate() method.
private Context context = this;
private String appID = "APP_ID"; // Replace with your App ID
private String region = "REGION"; // Replace with your App Region ("eu" or "us")

CallAppSettings callAppSettings = CallAppSettingBuilder()
  .setAppId(appID)
  .setRegion(region)
  .build();

CometChatCalls.init(
    context,
    callAppSettings,
    new CometChatCalls.CallbackListener<String>() {
        override public void onSuccess(String successMessage) {

        }

        override public void onError(CometChatException e) {

        }
    }
)
ParameterDescription
contextAndroid context for your application
callAppSettingsAn object of the CallAppSettings class

Best Practices

Call CometChatCalls.init() in your Application class or main activity’s onCreate() method to ensure the SDK is ready before any calling features are accessed.
Double-check your App ID and Region values from the CometChat Dashboard before deploying to production. Incorrect values will cause initialization failures.
Always implement the onError() callback to catch initialization failures. Common issues include network connectivity problems or incorrect credentials.

Troubleshooting

Symptom: CometChatCalls.init() fails with “Invalid App ID” or “Invalid Region” error.Cause: Incorrect App ID or Region value in initialization code.Solution: Verify your App ID and Region in the CometChat Dashboard under API & Auth Keys. Ensure the region is exactly “us” or “eu”.
Symptom: Gradle sync fails with “Could not resolve com.cometchat:calls-sdk-android” error.Cause: Maven repository URL not added to project-level build.gradle.Solution: Add the CometChat maven repository URL to the allprojects section in your project-level build.gradle file as shown in the setup instructions.
Symptom: Build fails with “Requires API level 24” error.Cause: Your app’s minSdkVersion is below the required API level 24 for calls SDK.Solution: Update your app-level build.gradle to set minSdkVersion 24 or higher.

Next Steps