Skip to main content
Monitor the call session lifecycle with SessionStatusListener. This listener provides callbacks for session join/leave events, connection status changes, and session timeouts.

Prerequisites

Register Listener

Register a SessionStatusListener to receive session status callbacks:
The listener is automatically removed when the LifecycleOwner (Activity/Fragment) is destroyed, preventing memory leaks.

Callbacks

onSessionJoined

Triggered when you successfully join a call session.
Use Cases:
  • Update UI to display the call interface
  • Start foreground service for ongoing call notification
  • Initialize call-related features

onSessionLeft

Triggered when you leave the call session (either by calling leaveSession() or being removed).
Use Cases:
  • Clean up call-related resources
  • Stop foreground service
  • Navigate away from call screen

onSessionTimedOut

Triggered when the session times out due to inactivity (e.g., being alone in the call for too long).
Configure the timeout period using setIdleTimeoutPeriod() in SessionSettings. Default is 300 seconds (5 minutes).
Use Cases:
  • Display timeout notification to user
  • Clean up resources and navigate away
  • Log analytics event

onConnectionLost

Triggered when the connection to the call server is lost (e.g., network issues).
Use Cases:
  • Display “Reconnecting…” indicator
  • Disable call controls temporarily
  • Log connection issue for debugging

onConnectionRestored

Triggered when the connection is restored after being lost.
Use Cases:
  • Hide reconnecting indicator
  • Re-enable call controls
  • Show success notification

onConnectionClosed

Triggered when the connection is permanently closed (cannot be restored).
Use Cases:
  • Display error message to user
  • Clean up resources
  • Navigate away from call screen

Complete Example

Here’s a complete example handling all session status events:

Callbacks Summary

Next Steps

Participant Event Listener

Handle participant join/leave and state changes

Media Events Listener

Handle recording, screen share, and media state changes