Browse SDKs · Android
Platform
SDKsAndroidIncludes Enterprise features

Conversation overview

Understand ConversationInfo, conversationID, conversation settings, and event handling in the OpenIM Android SDK.

Copy

A conversation maintains chat-list state for the authenticated user in a direct or group chat, represented by a ConversationInfo entity. It tracks unread counts, latest messages, pinning status, drafts, message reception options, and custom extension fields. A conversationID uniquely identifies a conversation and serves as the primary key when querying conversation metadata and updating conversation settings. In direct chats, the target is the peer userID; in group chats, the target is the groupID.

Group profiles, membership rosters, and permission management belong to group capabilities. Group chat screens use groupID when calling Group APIs, and use conversationID when managing conversation settings, unread counts, drafts, and message purging.

Conversation identifiers

IdentifierPurpose
conversationIDUnique conversation record ID for the current account, used for conversation settings, unread states, and message history.
userIDTarget user ID in a direct chat.
groupIDTarget group ID in a group chat, also used as the target identifier in Group APIs.
sourceIdTarget passed when generating or querying conversation IDs: userID for direct chats, groupID for group chats.

Conversation data

FieldDescription
conversationIDUnique conversation identifier.
conversationTypeConversation type: ConversationType.SINGLE_CHAT for direct chats; ConversationType.GROUP_CHAT or ConversationType.SUPER_GROUP_CHAT for group chats.
userID / groupIDuserID identifies the peer user in direct chats; groupID identifies the destination group in group chats. Exactly one is populated.
showNameConversation display name: peer user's nickname or remark in direct chats; group name or remark in group chats.
faceURLConversation avatar URL.
unreadCountUnread message count for this conversation.
latestMsgJSON string representation of the latest message.
latestMsgSendTimeUnix timestamp (in milliseconds) of the latest message.
recvMsgOptMessage reception option for this conversation.
groupAtTypeGroup mention reminder status.
draftTextDraft message text.
draftTextTimeUnix timestamp when the draft was last updated.
isPinnedWhether the conversation is pinned to the top of the list.
isPrivateChat EnterpriseWhether burn-after-reading mode is enabled.
burnDuration EnterpriseReading duration (in seconds) before messages are destroyed in burn-after-reading mode.
isMsgDestruct EnterpriseWhether scheduled server-side message deletion is active.
msgDestructTime EnterpriseRetention duration for scheduled server-side message deletion.
extReserved conversation extension string.
exCustom application-defined extension string.
isNotInGroupIndicates whether the current user is no longer a member of the group.

State updates

After registering OnConversationListener at the application layer, the client receives real-time event notifications for conversation list modifications and total unread count adjustments. Merge incremental changes and deduplicate items using conversationID as the primary key. For complete listener configuration, see Get the conversation list:

  • onNewConversation: Delivers newly created conversations to insert at the top or into custom sorted order.
  • onConversationChanged: Delivers conversations with modified attributes, such as unread count, latest message, pinning status, or draft changes.
  • onTotalUnreadMessageCountChanged: Delivers updates to the overall unread message counter for badge rendering.

ConversationManager retains a single listener instance; subsequent calls replace previously registered listeners. When logging out or switching accounts, reset event dispatching logic accordingly.