CometChatOngoingCall renders the active call: the Calls SDK’s video tiles and controls (mute, camera, switch camera, end). CometChatOngoingCallActivity hosts it full-screen, supports picture-in-picture, and is where an answered incoming call ends up: your app’s answer activity opens it with the answered call, and it joins the session.
Where It Fits
Every call ends up here:- Kotlin (XML Views)
- Jetpack Compose
Quick Start
From your answer activity (incoming calls)
The Push SDK opens your answer activity with the answered call in its intent. Turn it into a UI KitCall and launch this screen; it asks for the microphone (and the camera for a video call) and joins:
Launching it yourself
- Kotlin (XML Views)
- Jetpack Compose
Embedding the component
Use the component directly when you host the call in your own screen.- Kotlin (XML Views)
- Jetpack Compose
activity_call.xml
CometChatUIKit.init() with setEnableCalling(true), a user logged in, and com.cometchat:calls-sdk-android in your app’s dependencies (the UI Kit does not bundle it). There is nothing to declare for permissions: RECORD_AUDIO and CAMERA merge into your manifest from the SDKs and are requested at runtime.
Actions and Events
Callback Methods
onCallEnded
Fires when this device has left the session: the user tapped End, the other side hung up, the session timed out, or the connection closed. Close the screen here.
- Kotlin (XML Views)
- Jetpack Compose
The hosting
CometChatOngoingCallActivity finishes itself, and an embedded component finishes its host activity on CallEnded and SessionTimeout too. Observe the ViewModel’s events only for your own clean-up:onError
Fires when the session could not be joined (bad session id, no network, the Calls SDK not logged in). A denied microphone does not fire it: the call joins muted.
- Kotlin (XML Views)
- Jetpack Compose
ViewModel Events (OngoingCallEvent)
Global UI Events (CometChatEvents.callEvents)
SDK Events (Real-Time, Automatic)
Functionality
Hang-up and clean-up
Hanging up leaves the Calls SDK session withCallSession.leave(); nothing is sent to the Chat SDK. For a 1:1 call (DEFAULT) the UI Kit also clears its active-call state and, when the screen was opened with a Call, emits CometChatCallEvent.CallEnded on CometChatEvents.callEvents. A hang-up by the other side clears the same state but emits no global event; observe the component’s CallEnded instead. For a MEETING it only leaves and clears the meeting flag; the conference continues for the others.
CometChatOngoingCallActivity leaves the session when it is destroyed, but only its own session: after answering a second call over a live one, the Push SDK opens your answer activity again, which hands the new call to CometChatOngoingCallActivity. That intent arrives in onNewIntent (SINGLE_TOP); the activity starts a fresh instance for the new session and finishes itself, and the old screen’s clean-up does not touch the new session.
Picture-in-Picture
CometChatOngoingCallActivity declares supportsPictureInPicture and enters PiP when the user leaves the screen during a call; the Calls SDK switches to its PiP layout (enablePictureInPictureLayout / disablePictureInPictureLayout). Dismissing the PiP window ends the call. Nothing to configure.
Second call during a call
Handled by the Push SDK: the new call rings over the live one with “Answering ends your current call”. Answer leaves the live session, prepares the new one and opens your answer activity, which opensCometChatOngoingCallActivity for it; Decline sends busy and keeps the current call.
Style
- Kotlin (XML Views)
- Jetpack Compose
SessionSettingsBuilder; see Session Settings and Call Layouts.
See Component Styling for the full reference.
Next Steps
Calling Integration
Enable calling and push ringing
Outgoing Call
Calling and ringing states before the answer
Call Logs
View call history
Push Ringing
How incoming calls ring