Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
Real-time Presence
Configure presence subscription inAppSettings during SDK initialization. The AppSettingsBuilder provides three subscription options:
| Method | Description |
|---|---|
subscribePresenceForAllUsers() | Receive presence updates for all users |
subscribePresenceForRoles(roles) | Receive presence updates only for users with specified roles |
subscribePresenceForFriends() | Receive presence updates only for friends |
You must configure presence subscription in
AppSettings during CometChat.init() before any presence events will be delivered. See Setup SDK for details.UserListener to receive presence events:
- TypeScript
- JavaScript
| Parameter | Description |
|---|---|
listenerID | Unique identifier for the listener |
User object with presence information.
Relevant fields to access on returned users:
| Field | Getter | Return Type | Description |
|---|---|---|---|
| status | getStatus() | string | Online status of the user ("online" or "offline") |
| lastActiveAt | getLastActiveAt() | number | Timestamp when the user was last active |
Presence events are triggered for other users, not for yourself. For example, if User 1 is logged in and User 2 comes online, User 1 receives
onUserOnline for User 2. Neither User 1 nor User 2 receive presence events for their own status changes — only for others.- TypeScript
- JavaScript
User List Presence
When fetching users viaUsersRequest, each User object includes presence fields:
| Field | Description |
|---|---|
status | "online" or "offline" |
lastActiveAt | Timestamp of last activity (useful for “Last seen” display) |
Next Steps
Retrieve Users
Fetch user lists with filtering and pagination.
User Management
Create and update users programmatically.
Block Users
Block and unblock users to control communication.
SDK Setup
Configure AppSettings including presence subscriptions.