SessionStatusListener. This listener provides callbacks for session join/leave events, connection status changes, and session timeouts.
Prerequisites
- An active call session
- Access to the
CallSessioninstance
Register Listener
Register aSessionStatusListener to receive session status callbacks:
- Kotlin
- Java
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.- Kotlin
- Java
- 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 callingleaveSession() or being removed).
- Kotlin
- Java
- 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).- Kotlin
- Java
Configure the timeout period using
setIdleTimeoutPeriod() in SessionSettings. Default is 300 seconds (5 minutes).- 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).- Kotlin
- Java
- Display “Reconnecting…” indicator
- Disable call controls temporarily
- Log connection issue for debugging
onConnectionRestored
Triggered when the connection is restored after being lost.- Kotlin
- Java
- Hide reconnecting indicator
- Re-enable call controls
- Show success notification
onConnectionClosed
Triggered when the connection is permanently closed (cannot be restored).- Kotlin
- Java
- 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:- Kotlin
- Java
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