External Call Detection Events - Android
VideoSDK provides external call detection events that notify you when a participant is on another call while in a room. These events help track call states and handle UI changes accordingly.
onExternalCallRinging
- Triggered when an incoming phone call starts ringing on the device.
callTypeis alwaysCallType.INCOMING. Android reports no ringing for a call you place.
onExternalCallAnswered
- Triggered when a phone call starts on the device: the participant answers an incoming call or places an outgoing call.
callTypeisCallType.INCOMINGafteronExternalCallRinging, otherwiseCallType.OUTGOING.
onExternalCallRejected
- Triggered when a ringing call ends without being answered. Android can't tell a declined call from a missed one, so both arrive here.
callTypeis alwaysCallType.INCOMING.
onExternalCallHangup
- Triggered when an answered or placed call ends on the device.
callTypeis the same value thatonExternalCallAnsweredreported.
Override these methods in a RoomEventListener and register the listener with room.addEventListener(). They are delivered to the most recently joined room.
For example, suppose a room is running with Alice and Bob. If Alice receives a call, only Alice will receive the onExternalCallRinging event.
The SDK only reports these events. It does not mute, pause or leave the room on its own, so handle that in your app if you need to.
These events need the READ_PHONE_STATE permission. Declare it in AndroidManifest.xml and request it at runtime. Without it, the events never fire.
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Example
private val roomEventListener: RoomEventListener = object : RoomEventListener() {
// ...
override fun onExternalCallRinging(callType: CallType) {
Log.d("#VideoSDK", "onExternalCallRinging: $callType")
}
override fun onExternalCallAnswered(callType: CallType) {
Log.d("#VideoSDK", "onExternalCallAnswered: $callType")
}
override fun onExternalCallRejected(callType: CallType) {
Log.d("#VideoSDK", "onExternalCallRejected: $callType")
}
override fun onExternalCallHangup(callType: CallType) {
Log.d("#VideoSDK", "onExternalCallHangup: $callType")
}
}
override fun onCreate(savedInstanceState: Bundle?) {
// ...
// Add listener to room
room!!.addEventListener(roomEventListener)
}
API Reference
The API references for all the methods and events utilized in this guide are provided below.
Got a Question? Ask us on discord

