Browse SDKs · Android
SDKsAndroid

Conversation overview

Learn about ConversationInfo, conversationID, conversation settings, and conversation events in the Android SDK.

Copy

A conversation is the chat-list state maintained by the signed-in account for a one-to-one or group chat. A ConversationInfo record contains unread count, latest message, pinning, draft, message reception, and extension data. conversationID uniquely identifies a conversation and is used to query conversation information and set conversation state; the chat target is the peer userID for a one-to-one chat or the groupID for a group chat.

Group profile, membership, and permissions belong to Group APIs. Use groupID for group operations and conversationID for conversation settings, unread state, drafts, and message cleanup.

Conversation identifiers

IdentifierPurpose
conversationIDConversation record ID for settings, unread state, and message history.
userIDPeer user ID in a one-to-one chat.
groupIDGroup ID for a group chat and Group API target.
sourceIdChat target passed to queries and ID resolution: userID for a one-to-one chat, groupID for a group chat.

ConversationInfo

FieldDescription
conversationIDConversation ID.
conversationTypeConversation type: ConversationType.SINGLE_CHAT for one-to-one chats; ConversationType.GROUP_CHAT or ConversationType.SUPER_GROUP_CHAT for group chats.
userID / groupIDuserID identifies the peer user in a one-to-one chat, while groupID identifies the target group in a group chat. Only one applies.
showNameConversation name: the target user's nickname or remark for a one-to-one chat, and the group name or remark for a group chat.
faceURLConversation avatar URL.
unreadCountUnread count for the conversation.
latestMsgJSON string for the latest message.
latestMsgSendTimeSend time of the latest message.
recvMsgOptMessage reception option for the conversation.
groupAtTypeGroup mention reminder state.
draftTextConversation draft.
draftTextTimeDraft update time.
isPinnedWhether the conversation is pinned.
isPrivateChatWhether burn after reading is enabled.
burnDurationReading duration for burn-after-reading messages, in seconds.
isMsgDestructWhether scheduled server-message deletion is enabled.
msgDestructTimeScheduled server-message deletion time.
extReserved conversation extension string.
exApplication-defined conversation extension string.
isNotInGroupWhether the current user is no longer in the group.

Find pages by task

State updates

After you set an OnConversationListener, you can receive changes to the conversation list and total unread count. See Get the conversation list for complete listener setup:

  • onNewConversation: Receives newly created conversations.
  • onConversationChanged: Receives conversation property changes, such as unread count, pinning, and drafts.
  • onTotalUnreadMessageCountChanged: Receives changes to the signed-in account's total unread message count.

Each call to setOnConversationListener() replaces the previously set listener.