Skip to main content

Overview

Three related features help users keep track of what matters: The options, confirmation dialogs, toasts and indicators are built into the UI Kit components. The only integration work is wiring the two full-screen views into your navigation.

Prerequisites

  • A working message view — see Getting Started.
  • The features enabled for your app. Check at runtime with the flags on CometChatUIKit:

Pin & Save in the Message List

With the features enabled, CometChatMessageList automatically adds Pin message / Unpin message and Save message / Unsave message to the long-press action sheet for text and media messages. The labels toggle with the message’s current state.
  • Pin is role-gated in groups: the UI Kit shows the Pin/Unpin option only to participants with the Admin or Moderator scope, or the group owner. Everyone sees pinned indicators. In one-on-one chats both participants can pin. Note this gate is applied by the UI Kit — if you build custom pin UI directly on the SDK, apply your own role check.
  • Save has no role gating — every user can save any message.
  • Pin and Save apply immediately and show a toast (Message pinned, Message saved, …); Unpin and Unsave ask for confirmation first. If a pin or save limit is exceeded, the limit toast is generated from the server’s response automatically.
  • Pinned and saved messages show indicators in the bubble footer (a filled pin / bookmark before the timestamp), updating live for all bubble types.

Step 1: Open Pinned Messages from the Chat Header

CometChatMessageHeader has a built-in Pinned messages menu item — enable it and handle the tap:
MessagesActivity.kt
Host CometChatPinnedMessages in that activity (or Compose destination), scoped with the same user/group as the chat.

Jump Back to a Pinned Message

Return the tapped message’s ID to the chat screen and scroll to it:
PinnedMessagesActivity.kt
MessagesActivity.kt

Step 2: Open Saved Messages from Your App Chrome

Saved messages are user-level, so the entry point belongs in app chrome — a profile/user menu on the conversations screen, a settings row, or a navigation tab — not inside a single chat:
ChatsFragment.kt
Host CometChatSavedMessages there. Because rows span conversations, opening a tapped message means resolving its source conversation first:
SavedMessagesActivity.kt

Pin Conversations

With the feature enabled, CometChatConversations adds Pin conversation / Unpin conversation to the long-press menu, shows a pin indicator on pinned rows, and keeps pinned conversations at the top of the list — including when new messages arrive. No wiring is required; to hide the option:

Live Updates

On the acting user’s device, all surfaces stay in sync through the UI Kit event bus — pinning from the action sheet updates the bubble indicator and the Pinned Messages screen without a refetch. Delivery of pin/save events to other participants and to the user’s other devices activates once server-side real-time delivery for these features is rolled out; until then, other clients pick the change up on their next fetch. If you build custom UI, observe the MessagePinned / MessageUnpinned / MessageSaved / MessageUnsaved events; see Events.

Summary / Feature Matrix

Next Steps & Further Reading