Skip to main content
CometChatSavedMessages lists every message the logged-in user has saved, newest save first. Unlike a pin, a save is private and spans conversations — nobody else can see it, and the list is not scoped to a single chat.
Save Messages must be enabled for your app through the features.ux.messages.saved.enabled app setting in the CometChat Dashboard. Until it is, the Save option never renders and this screen has nothing to show. Read the flag with CometChatUIKit.isSaveMessageEnabled() to gate your own entry point.

Where It Fits

Because the list is account-wide, this screen belongs at app level — a navigation tab, a drawer entry, or a profile menu — not inside a single conversation. There is deliberately no setUser/setGroup; scoping it to one conversation would defeat the point. Messages are saved and unsaved from the Message List action sheet; this screen is the read view, plus a long-press Unsave action on each row.
The Saved Messages screen: a titled screen with a back arrow, listing the user's saved messages from across every conversation as conversation-style rows. Each row shows the source conversation's avatar and name, a one-line preview with a type glyph for media, documents, stickers and contacts, and the time it was saved.

Quick Start

Add the component to your layout XML:
activity_saved_messages.xml
Wire the callbacks:
SavedMessagesActivity.kt

Actions and Events

Callback Methods

SDK Events (Real-Time, Automatic)

The list keeps itself up to date on this device — saving or unsaving a message anywhere in the app adds or removes the row without a refetch, via the MessageSaved / MessageUnsaved events on the UI Kit event bus; see Events. Changes made on the user’s other devices appear when the list is next opened or refetched (server-side real-time delivery for save events is pending rollout).

Functionality

  • Conversation-style rows — because saved messages come from many conversations, each row shows where the message lives: the peer’s or group’s avatar and name, a message preview with its type icon, and the sent date. This mirrors a conversation list row (without the unread badge).
  • Unsave — long-press a row to get the Unsave action, which asks for confirmation before it is performed; a toast reports the result. This mirrors the Unpin flow on the Pinned Messages screen.
  • Jump to message — tapping a row emits the message through the click callback. Use the message’s receiver type and receiver to resolve which conversation to open.
  • Empty state — a built-in empty state (“No saved messages yet”) is shown when the user has not saved anything.
  • Private and read-only — nobody else can see a user’s saved messages; the screen never marks messages as read and does not affect unread counts or receipts.

ViewModel

The screen is backed by CometChatSavedMessagesViewModel (in the shared core module), which fetches via MessagesRequestBuilder().setSaved(true), applies optimistic unsave with revert-on-error, and observes the event bus for live upkeep. In Compose you can inject your own instance through the viewModel parameter.

Next Steps