Configure CometChat Calls SDK v5 idle timeout on Android to handle inactive participants and call session cleanup.
Configure automatic session termination when a user is alone in a call. Idle timeout helps manage resources by ending sessions that have no active participants.
When a user is the only participant in a call session, the idle timeout countdown begins. If no other participant joins before the timeout expires, the session automatically ends and the onSessionTimedOut callback is triggered.The timer also restarts when other participants leave and only one user remains in the call.This is useful for:
Preventing abandoned call sessions from running indefinitely
Managing server resources efficiently
Providing a better user experience when the other party doesn’t join
Listen for the onSessionTimedOut callback using SessionStatusListener to handle when the session ends due to idle timeout:
Kotlin
Java
val callSession = CallSession.getInstance()callSession.addSessionStatusListener(this, object : SessionStatusListener() { override fun onSessionTimedOut() { Log.d(TAG, "Session ended due to idle timeout") // Show message to user showToast("Call ended - no other participants joined") // Navigate away from call screen finish() } override fun onSessionJoined() {} override fun onSessionLeft() {} override fun onConnectionLost() {} override fun onConnectionRestored() {} override fun onConnectionClosed() {}})
CallSession callSession = CallSession.getInstance();callSession.addSessionStatusListener(this, new SessionStatusListener() { @Override public void onSessionTimedOut() { Log.d(TAG, "Session ended due to idle timeout"); // Show message to user showToast("Call ended - no other participants joined"); // Navigate away from call screen finish(); } @Override public void onSessionJoined() {} @Override public void onSessionLeft() {} @Override public void onConnectionLost() {} @Override public void onConnectionRestored() {} @Override public void onConnectionClosed() {}});