cometchat-android-v5-calls
CometChat Calls SDK v5 integration for native Android (V5 stable, Java + Kotlin Views). Covers SDK setup (Cloudsmith Maven, CallAppSettings, init), the dual-SDK ringing pattern (Chat SDK initiateCall + Calls SDK joinSession), session settings, event listeners, call logs, recording, screen sharing, picture-in-picture, foreground service for ongoing calls, VoIP push via FCM + ConnectionService, audio/video/participant controls, custom UI, and in-call chat. Use in standalone mode (calls is the product) or additive mode (calls layered on top of an existing CometChat Android v5 chat integration).
cometchat · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add cometchat/cometchat-skills --skill cometchat-android-v5-calls技能说明
name: cometchat-android-v5-calls description: CometChat Calls SDK v5 integration for native Android (V5 stable, Java + Kotlin Views). Covers SDK setup (Cloudsmith Maven, CallAppSettings, init), the dual-SDK ringing pattern (Chat SDK initiateCall + Calls SDK joinSession), session settings, event listeners, call logs, recording, screen sharing, picture-in-picture, foreground service for ongoing calls, VoIP push via FCM + ConnectionService, audio/video/participant controls, custom UI, and in-call chat. Use in standalone mode (calls is the product) or additive mode (calls layered on top of an existing CometChat Android v5 chat integration). license: "MIT" compatibility: "Android Studio Hedgehog+, JDK 17, Gradle 8+, AGP 8+, minSdk 26+, compileSdk 35; com.cometchat:calls-sdk-android:5.x; com.cometchat:chat-sdk-android:4.x (when ringing)" metadata: author: "CometChat" version: "4.0.0" tags: "cometchat android v5 calls voice video webrtc kotlin java cloudsmith callappsettings session-settings call-logs recording screen-sharing pip foreground-service voip fcm connectionservice"
Purpose
Production-grade voice + video calling for native Android v5. Loaded by the cometchat-calls dispatcher when the project is Android v5 (detected from chat-sdk-android:4.x / chatuikit-android:5.x or asked when greenfield). Operates in two modes:
- Standalone — calls is the product. No
chatuikit-androidUI Kit; justchat-sdk-android(for signaling) +calls-sdk-android+ your own UI surfaces (CallButton on profile, CallLogsActivity, OngoingCallActivity). - Additive — calls layered onto an existing v5 chat integration. The kit's
CometChatMessageHeaderalready exposes call buttons; this skill wires them to the Calls SDK and mounts the globalIncomingCalllistener at app root.
Read these other skills first:
cometchat-calls— the dispatcher (mode selection, hard rules, anti-patterns)cometchat-android-v5-core— Chat SDK init, login order,local.properties+BuildConfigcredential conventions, Application class wiring
Ground truth:
- SDK source —
calls-sdk-android-5/sdk/ - Sample app —
calls-sdk-android-5/samples/ - Pre-authored topic docs —
references/in this skill (16 docs, ~2300 lines, audited againstcalls-sdk-android@5.0.x(v5 GA)) - Public docs — https://www.cometchat.com/docs/calls/android/overview
How to use this skill
This SKILL.md is the index + hard rules + Android-specific gotchas. Deep topic content lives in references/. Always read this file end-to-end first; load references on demand.
| Topic | Reference file | When to load |
|---|---|---|
| SDK setup (Cloudsmith, init, permissions, Jetifier) | references/setup.md | Step 1 of every integration |
Joining a session (SessionSettingsBuilder, voice vs video) | references/join-session.md | Step 2 — every integration |
| Dual-SDK ringing (Chat SDK + Calls SDK together) | references/ringing-integration.md | Standalone or additive — every integration with peer-to-peer call flow |
All SessionSettingsBuilder options (layouts, mode, hide buttons) | references/session-settings.md | When customizing in-call UI behavior |
| Event listeners (status, participant, media, button-click, layout) | references/event-listeners.md | When wiring call lifecycle to app state |
| Call history list | references/call-logs.md | When adding /calls route or in-app history |
| Recording (auto-start, recording events) | references/recording.md | Feature add |
| Screen sharing (viewer + presenter status) | references/screen-sharing.md | Feature add |
| Picture-in-picture | references/picture-in-picture.md | Feature add |
| Foreground service for ongoing calls | references/background-handling.md | Required — every standalone integration on Android 14+ |
| VoIP push (ConnectionService + FCM high-priority + PhoneAccount) | references/voip-calling.md | Required — every standalone integration; optional but strongly recommended in additive |
| Audio controls (mute/unmute, device switching) | references/audio-controls.md | Default UI customization |
| Video controls (camera on/off, switch camera) | references/video-controls.md | Default UI customization |
| Participant management (mute/kick/raise hand) | references/participant-management.md | Group calls / moderator features |
| Custom UI (control panel, participant list, layout) | references/custom-ui.md | When the default UI doesn't fit |
| In-call chat (messaging during active session) | references/in-call-chat.md | Feature add |
references/README.md is a skim-friendly index of the same.
1. The seven hard rules
These are the production-grade non-negotiables from the cometchat-calls dispatcher, specialized for Android v5. Every integration this skill writes must satisfy all seven.
1.0 Calls SDK login is its own step (v5+)
The v5 Calls SDK has its own auth state, separate from the Chat SDK. After CometChat.login(uid, AUTH_KEY) succeeds, you MUST also call CometChatCalls.login(uid, AUTH_KEY, ...) — without it, the FIRST calls API call (initiateCall, joinSession, generateToken) throws "auth token cannot be null".
import com.cometchat.calls.core.CometChatCalls
import com.cometchat.calls.exceptions.CometChatException as CallsException
import com.cometchat.calls.model.CallUser // ← callback type, NOT chat User
// ✓ RIGHT — chat login first, then calls login
CometChat.login(uid, AUTH_KEY, object : CometChat.CallbackListener<User>() {
override fun onSuccess(user: User) {
CometChatCalls.login(uid, AUTH_KEY,
object : CometChatCalls.CallbackListener<CallUser>() {
override fun onSuccess(callUser: CallUser) { /* both ready */ }
override fun onError(e: CallsException) { /* surface */ }
})
}
override fun onError(e: CometChatException) { /* surface */ }
})
Surprises:
- The chat-side
Userobject does NOT expose `authTok