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)
Functionality
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