Skip to main content
CometChatOutgoingCall renders the outgoing call screen and transitions to the ongoing call screen when the receiver accepts. It displays the recipient’s avatar, name, call status, and an end-call button.

Where It Fits

CometChatOutgoingCall is a call-initiation component. Wire it to CometChatCallEvents to handle call-accepted and call-rejected transitions.
activity_call.xml
<com.cometchat.uikit.kotlin.presentation.outgoingcall.CometChatOutgoingCall
    android:id="@+id/outgoing_call"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
val outgoingCall = findViewById<CometChatOutgoingCall>(R.id.outgoing_call)
outgoingCall.setCall(call)

Quick Start

Add to your layout XML:
<com.cometchat.uikit.kotlin.presentation.outgoingcall.CometChatOutgoingCall
    android:id="@+id/outgoing_call"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
Set the Call object — this is required:
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_call)

    val outgoingCall = findViewById<CometChatOutgoingCall>(R.id.outgoing_call)
    outgoingCall.setCall(call)
}
Prerequisites: CometChat SDK initialized with CometChatUIKit.init(), a user logged in, and the UI Kit dependency added.

Actions and Events

Callback Methods

onEndCallClick

Fires when the end-call button is tapped. Default: cancels the outgoing call via the SDK.
outgoingCall.setOnEndCallClick {
    // Custom end-call logic
}

onError

Fires on internal errors (network failure, auth issue, SDK exception).
outgoingCall.setOnError { context, exception ->
    Log.e("OutgoingCall", "Error: ${exception.message}")
}

Global UI Events (CometChatCallEvents)

EventFires whenPayload
ccCallAcceptedOutgoing call accepted by receiverCall
ccCallRejectedOutgoing call rejected by receiverCall

SDK Events (Real-Time, Automatic)

SDK ListenerInternal behavior
onOutgoingCallAcceptedTransitions to the ongoing call screen
onOutgoingCallRejectedFinishes the activity or invokes back-press handler

Functionality

Method (Kotlin XML)Compose ParameterDescription
setCall(call)call = callSet the Call object (required)
setOnEndCallClick { }onEndCallClick = { }Override end-call button behavior
setOnError { }onError = { }Error callback
setDisableSoundForCalls(true)disableSoundForCalls = trueDisable outgoing call ringtone
setCustomSoundForCalls(R.raw.tone)customSoundForCalls = R.raw.toneCustom ringtone

Custom View Slots

Title View

Replace the name / title text area.
outgoingCall.setTitleView { context, call ->
    val titleView = LayoutInflater.from(context).inflate(R.layout.custom_title_view, null)
    val tvTitle = titleView.findViewById<TextView>(R.id.title_text)
    val user = call?.callReceiver as User
    tvTitle.text = user.name + " <> " + call.sender.uid
    titleView
}

Avatar View

Replace the avatar / profile picture area.
outgoingCall.setAvatarView { context, call ->
    val avatarView = LayoutInflater.from(context).inflate(R.layout.custom_avatar_view, null)
    val avatar = avatarView.findViewById<CometChatAvatar>(R.id.avatar)
    val user = call?.receiver as User
    avatar.setAvatar(user.uid, user.avatar)
    avatarView
}

Cancel Button View

Replace the end-call button.
outgoingCall.setEndCallView { context, call ->
    val endCallView = LayoutInflater.from(context).inflate(R.layout.end_call_button, null)
    endCallView.setOnClickListener {
        Toast.makeText(context, "End call clicked", Toast.LENGTH_SHORT).show()
    }
    val layoutParams = LinearLayout.LayoutParams(
        ViewGroup.LayoutParams.MATCH_PARENT,
        ViewGroup.LayoutParams.WRAP_CONTENT
    )
    layoutParams.bottomMargin = Utils.convertDpToPx(context, 40)
    endCallView.layoutParams = layoutParams
    endCallView
}

Style

Define a custom style in themes.xml:
themes.xml
<style name="CustomOutgoingCallStyle" parent="CometChatOutgoingCallStyle">
    <item name="cometchatOutgoingCallBackgroundColor">#FEEDE1</item>
    <item name="cometchatOutgoingCallTitleTextColor">#F76808</item>
    <item name="cometchatOutgoingCallSubtitleTextColor">#F76808</item>
</style>
outgoingCall.setStyle(R.style.CustomOutgoingCallStyle)
See Component Styling for the full reference.

Next Steps

Incoming Call

Incoming call notification with accept/reject

Call Buttons

Voice and video call buttons

Call Logs

View call history

Conversations

Browse recent conversations