Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
CometChat’s Calls feature allows you to integrate one-on-one and group audio/video calling capabilities into your application. In V6, calling is built into the cometchat_chat_uikit package — no separate calls dependency needed.
Integration
Step 1: Add Dependency
Since V6 is hosted on Cloudsmith, install via CLI:
dart pub add cometchat_chat_uikit:6.0.0-beta1 --hosted-url https://dart.cloudsmith.io/cometchat/cometchat/
Or add manually to pubspec.yaml:
dependencies:
cometchat_chat_uikit:
hosted: https://dart.cloudsmith.io/cometchat/cometchat/
version: 6.0.0-beta1
Step 2: Update build.gradle
Set minSdkVersion to at least 24 in android/app/build.gradle:
defaultConfig {
minSdkVersion 24
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Step 3: Update iOS Podfile
In ios/Podfile, set the minimum iOS version to 12:
Step 4: Modify UIKitSettings
Activate calling features by setting enableCalls to true in UIKitSettings:
UIKitSettings uiKitSettings = (UIKitSettingsBuilder()
..subscriptionType = CometChatSubscriptionType.allUsers
..autoEstablishSocketConnection = true
..region = "REGION"
..appId = "APP_ID"
..authKey = "AUTH_KEY"
..enableCalls = true
..callingConfiguration = CallingConfiguration()
).build();
CometChatUIKit.init(uiKitSettings: uiKitSettings,
onSuccess: (successMessage) {},
onError: (e) {},
);
To allow launching the Incoming Call screen from any widget, provide the navigator key:
MaterialApp(
navigatorKey: CallNavigationContext.navigatorKey,
home: YourHomeScreen(),
)
Listeners
Register call listeners for top-level widgets:
class _YourClassNameState extends State<YourClassName> with CallListener {
@override
void initState() {
super.initState();
CometChat.addCallListener(listenerId, this);
}
@override
void dispose() {
super.dispose();
CometChat.removeCallListener(listenerId);
}
@override
void onIncomingCallReceived(Call call) {
debugPrint("onIncomingCallReceived");
}
@override
void onOutgoingCallAccepted(Call call) {
debugPrint("onOutgoingCallAccepted");
}
@override
void onOutgoingCallRejected(Call call) {
debugPrint("onOutgoingCallRejected");
}
@override
void onIncomingCallCancelled(Call call) {
debugPrint("onIncomingCallCancelled");
}
@override
void onCallEndedMessageReceived(Call call) {
debugPrint("onCallEndedMessageReceived");
}
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
Features
Incoming Call
The Incoming Call widget lets users receive real-time audio and video calls. When a call is received, it displays caller information with accept/reject options.
Outgoing Call
The Outgoing Call widget manages the outgoing call process. It displays recipient information and call status, and automatically transitions to the ongoing call screen when accepted.
Call Logs
The Call Logs widget displays records of call events including caller, time, and duration.