Skip to main content
Events enable a decoupled, flexible architecture in the CometChat UI Kit. Components and Composite Components emit events in response to user interactions or state changes, allowing other parts of your application to react without direct references between components.

When to use this

  • You need to update your UI when a user is blocked or unblocked.
  • You need to respond to group actions such as member joins, kicks, bans, or ownership transfers.
  • You need to track conversation deletions or updates in real time.
  • You need to react to messages being sent, edited, deleted, or read.
  • You need to handle call lifecycle events (outgoing, accepted, rejected, ended).
  • You need to respond to UI-level events such as panel visibility changes or active chat changes.

Prerequisites

  • The cometchat-chat-uikit-android dependency added to your project.
  • CometChatUIKit.init() called and completed successfully.
  • A logged-in CometChat user (call CometChatUIKit.login() before registering listeners).

API reference

User Events

CometChatUserEvents emits events when the logged-in user executes actions on another user. This class provides methods to add and remove listeners for user events, as well as methods to handle specific user actions such as blocking and unblocking users. Events: Listener registration:
What this does: Registers a listener on CometChatUserEvents using a unique LISTENERS_TAG. The ccUserBlocked callback fires when the logged-in user blocks another user, and ccUserUnblocked fires when the logged-in user unblocks another user.

Group Events

CometChatGroupEvents emits events when the logged-in user performs actions related to groups. This class provides methods to listen to various group-related events and handle them. Events: Listener registration:
What this does: Registers a listener on CometChatGroupEvents using a unique LISTENERS_TAG. Each callback fires when the logged-in user performs the corresponding group action — creating, deleting, leaving a group, or managing members (scope change, ban, kick, unban, join, add, ownership transfer).

Conversation Events

CometChatConversationEvents emits events when the logged-in user performs actions related to conversations. This allows the UI to be updated when conversations change. Events: Listener registration:
What this does: Registers a listener on CometChatConversationEvents using a unique listener tag. The ccConversationDeleted callback fires when the logged-in user deletes a conversation, and ccUpdateConversation fires when a conversation is updated.

Message Events

CometChatMessageEvents emits events when various actions are performed on messages within the application. These events facilitate updating the UI when messages change. Events: Listener registration:
What this does: Registers a listener on CometChatMessageEvents using a unique ID string. The callbacks fire for message lifecycle events — sending, editing, deleting, reading messages, and reacting with live reactions. Additional overrides handle interactive message types (onFormMessageReceived, onCardMessageReceived, onCustomInteractiveMessageReceived, onInteractionGoalCompleted, onSchedulerMessageReceived).

Call Events

CometChatCallEvents emits events related to calls within the application. This class provides methods to listen to call-related events and handle them. Events: Listener registration:
What this does: Registers a listener on CometChatCallEvents using a unique "ListenerID". The callbacks fire for each stage of the call lifecycle — initiating an outgoing call, accepting, rejecting, and ending a call.

UI Events

CometChatUIEvents emits events related to UI components within the CometChat UI Kit. This class provides methods to listen to UI-related events and handle them. Events: Listener registration:
What this does: Registers a listener on CometChatUIEvents using a unique ID string. The callbacks fire for UI-level actions — showing or hiding custom panels, reacting to active chat changes, and opening a chat with a specific user or group.

Removing event listeners

Each event listener class provides methods to add and remove listeners. If you register a listener, remove it when the component or activity is destroyed to prevent memory leaks. Use the same tag or ID string you passed during registration.

Next steps

Methods Reference

UI Kit wrapper methods for initialization, authentication, and sending messages

Conversations

Display and manage the conversation list, which reacts to conversation events

Message List

Display messages in a chat, which reacts to message events