Quick Reference for AI Agents & DevelopersRequired Credentials: App ID, Region
Get from: CometChat Dashboard → Your App → API & Auth Keys
Get from: CometChat Dashboard → Your App → API & Auth Keys
Get your Application Keys
Sign up for CometChat and then:- Create a new app
- 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 levelbuild.gradle file in the repositories block under the allprojects section:
- Groovy
build.gradle file in the dependencies section.
- Groovy
Initialize CometChatCalls
Theinit() method initializes the settings required for CometChatCalls. The init() method takes the following parameters:
context- Your activity contextcallAppSettings- An object of theCallAppSettingsclass created using theCallAppSettingBuilderclass. TheappIdandregionfields are mandatory and can be set using thesetAppId()andsetRegion()methods.
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.
init() method in the activity’s onCreate() method.
- Java
- Kotlin
| Parameter | Description |
|---|---|
context | Android context for your application |
callAppSettings | An object of the CallAppSettings class |
Best Practices
Initialize Early in App Lifecycle
Initialize Early in App Lifecycle
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.Verify Credentials Before Release
Verify Credentials Before Release
Double-check your App ID and Region values from the CometChat Dashboard before deploying to production. Incorrect values will cause initialization failures.
Handle Initialization Errors
Handle Initialization Errors
Always implement the
onError() callback to catch initialization failures. Common issues include network connectivity problems or incorrect credentials.Troubleshooting
Initialization Failed
Initialization Failed
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”.Dependency Resolution Failed
Dependency Resolution Failed
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.Minimum API Level Error
Minimum API Level Error
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.