Drop-in Compatibility
Calls SDK v5 is a drop-in replacement for v4. All v4 APIs are preserved as deprecated methods that internally delegate to the new v5 implementations. You can update the dependency version and your existing code will compile and run without changes.If you’re using CometChat UI Kits, simply updating the Calls SDK version is sufficient. The UI Kit will continue to work with v5 through the deprecated compatibility layer.
Why Migrate to v5 APIs?
While v4 APIs will continue to work, migrating to v5 APIs gives you:- Lifecycle-aware listeners that auto-cleanup when your Activity/Fragment is destroyed — no more manual
removeCallsEventListeners()calls - Granular event listeners — 5 focused listener interfaces instead of one monolithic
CometChatCallsEventsListener CallSessionsingleton for cleaner session control — all actions on a single object instead of scattered static methods- Dedicated
login()method — the Calls SDK now handles its own authentication instead of depending on the Chat SDK’s auth token or REST APIs - Strongly-typed enums —
AudioMode,SessionType,LayoutType,CameraFacinginstead of raw strings
Initialization
No changes required. Theinit() API is the same in v5.
Authentication
In v4, the Calls SDK had no dedicated authentication step. It relied on the Chat SDK’s auth token (CometChat.getUserAuthToken()) or a REST API to obtain an auth token, which you then passed manually to methods like generateToken(sessionId, authToken, listener).
v5 introduces its own login() method. After calling login(), the SDK caches the auth token internally, so you no longer need to pass it around to other API calls.
- v4
- v5
Call
CometChatCalls.login() once after your user authenticates (e.g., right after CometChat.login() succeeds). The SDK stores the auth token internally, so subsequent calls like generateToken() and joinSession() use it automatically without you having to pass it.Session Settings
CallSettings and CallSettingsBuilder are replaced by SessionSettings and SessionSettingsBuilder. The builder methods have been renamed for clarity.
- v4
- v5
Builder Method Mapping
Joining a Session
startSession() is replaced by joinSession() which returns a CallSession object for controlling the call.
- v4
- v5
- v5
joinSession()returns aCallSessionobject (not a rawString) - v5 accepts the
GenerateTokenobject directly (not just the token string) - v5 offers a convenience overload that takes
sessionIddirectly and handles token generation internally
Session Control (Actions)
In v4, session actions were static methods onCometChatCalls. In v5, they’re instance methods on CallSession.
- v4
- v5
Action Method Mapping
Event Listeners
This is the biggest improvement in v5. The singleCometChatCallsEventsListener is replaced by 5 focused, lifecycle-aware listeners.
v4: Single Monolithic Listener
v5: Focused Lifecycle-Aware Listeners
v5 listeners are lifecycle-aware — pass your Activity or Fragment as the first parameter and they’ll be automatically removed when the lifecycle owner is destroyed. No need to call
removeCallsEventListeners().Event Mapping
New Events in v5
These events are only available with the v5 listener APIs:Call Logs
TheCallLogRequest API is unchanged. The only deprecated method is setAuthToken() — in v5, auth is handled by CometChatCalls.login().
- v4
- v5