Documentation Index
Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
CometChatCallButtons renders voice and video call buttons and initiates calls for the bound User or Group. Place it in a CometChatMessageHeader or anywhere a call action is needed.
Where It Fits
CometChatCallButtons is a utility component. Wire it into a CometChatMessageHeader or place it standalone wherever a call action is needed.
- Kotlin (XML Views)
- Jetpack Compose
activity_chat.xml
Quick Start
- Kotlin (XML Views)
- Jetpack Compose
Add to your layout XML:Set a Or programmatically:
User or Group — required before calls can be initiated:CometChatUIKit.init(), a user logged in, and the UI Kit dependency added.
You must callsetUser(User)orsetGroup(Group)before the buttons can initiate a call. Without a target, button clicks have no effect.
Actions and Events
Callback Methods
onVoiceCallClick
Fires when the voice call button is tapped. Replaces the default behavior of initiating an audio call.
- Kotlin (XML Views)
- Jetpack Compose
onVideoCallClick
Fires when the video call button is tapped. Replaces the default behavior of initiating a video call.
- Kotlin (XML Views)
- Jetpack Compose
onError
Fires on internal errors (network failure, auth issue, SDK exception).
- Kotlin (XML Views)
- Jetpack Compose
Global UI Events (CometChatCallEvents)
| Event | Fires when | Payload |
|---|---|---|
ccOutgoingCall | An outgoing call is initiated | Call |
ccCallAccepted | A call is accepted by the recipient | Call |
ccCallRejected | A call is rejected by the recipient | Call |
ccCallEnded | A call is ended | Call |
Functionality
| Method (Kotlin XML) | Compose Parameter | Description |
|---|---|---|
setUser(user) | user = user | Set the user to call (required for 1-on-1) |
setGroup(group) | group = group | Set the group to call (required for group calls) |
setOnVoiceCallClick { } | onVoiceCallClick = { } | Override voice call button behavior |
setOnVideoCallClick { } | onVideoCallClick = { } | Override video call button behavior |
setOnError { } | onError = { } | Error callback |
setVoiceCallButtonVisibility(View.GONE) | hideVoiceCallButton = true | Toggle voice call button |
setVideoCallButtonVisibility(View.GONE) | hideVideoCallButton = true | Toggle video call button |
Style
- Kotlin (XML Views)
- Jetpack Compose
Define a custom style in
themes.xml:themes.xml
ViewModel
- Kotlin (XML Views)
- Jetpack Compose
Next Steps
Call Logs
View call history
Incoming Call
Incoming call notification with accept/reject
Outgoing Call
Outgoing call screen with end-call button
Message Header
Display user/group info in the toolbar