IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMConversation

Public Member Functions

String getConversationID ()
 
int getType ()
 
String getUserID ()
 
String getGroupID ()
 
String getShowName ()
 
String getFaceUrl ()
 
int getRecvOpt ()
 
String getGroupType ()
 
int getUnreadCount ()
 
V2TIMMessage getLastMessage ()
 
String getDraftText ()
 
long getDraftTimestamp ()
 
List< V2TIMGroupAtInfogetGroupAtInfoList ()
 
boolean isPinned ()
 
long getOrderKey ()
 
List< Long > getMarkList ()
 
String getCustomData ()
 
List< String > getConversationGroupList ()
 
long getC2CReadTimestamp ()
 
long getGroupReadSequence ()
 

Static Public Attributes

static final int CONVERSATION_TYPE_INVALID = 0
 
static final int V2TIM_C2C = 1
 
static final int V2TIM_GROUP = 2
 
static long V2TIM_CONVERSATION_MARK_TYPE_STAR = 0x1
 
static long V2TIM_CONVERSATION_MARK_TYPE_UNREAD = 0x1 << 1
 
static long V2TIM_CONVERSATION_MARK_TYPE_FOLD = 0x1 << 2
 
static long V2TIM_CONVERSATION_MARK_TYPE_HIDE = 0x1 << 3
 

Member Function Documentation

◆ getConversationID()

String getConversationID ( )
inline

Get the conversation ID

Returns
Conversation ID

◆ getType()

int getType ( )
inline

Get the conversation type

Returns
Conversation type

◆ getUserID()

String getUserID ( )
inline

If the conversation is a one-to-one chat, the user ID of the remote user will be returned; otherwise, null will be returned.

Returns
User's userID

◆ getGroupID()

String getGroupID ( )
inline

If the conversation is a group chat, the group ID will be returned; otherwise, null will be returned.

Returns
Group ID

◆ getShowName()

String getShowName ( )
inline

Get the conversation display name. The priorities are as follows:

  • Group: group name -> group ID
  • One-to-one: Alias -> nickname -> user ID
Returns
Display name

◆ getFaceUrl()

String getFaceUrl ( )
inline

Get the conversation display profile photo

  • Group: group profile photo
  • One-to-one: the remote user's profile photo
Returns

◆ getRecvOpt()

int getRecvOpt ( )
inline

Get the message receiving option (Receive | Receive but not notify | Not receive)

Returns

◆ getGroupType()

String getGroupType ( )
inline

Get the group type (valid for group conversations only)

Returns

◆ getUnreadCount()

int getUnreadCount ( )
inline

Get the unread count

Returns

◆ getLastMessage()

V2TIMMessage getLastMessage ( )
inline

Get the last message of the conversation

Attention
In versions earlier than 5.5.892, please sort conversations by "lastMessage -> timestamp". The later the timestamp, the higher a conversation will appear on the list.

◆ getDraftText()

String getDraftText ( )
inline

Get the draft of an unsent message (a draft message is stored locally only and will be lost after the app is reinstalled)

Returns
The draft content. If the draft does not exist or an error occurs, null will be returned.

◆ getDraftTimestamp()

long getDraftTimestamp ( )
inline

Get the UTC timestamp when the draft was last set

Returns
Time, in seconds

◆ getGroupAtInfoList()

List<V2TIMGroupAtInfo> getGroupAtInfoList ( )
inline

Get a list of @ messages. This API can be used to notify a user when they are mentioned or all members are mentioned in a group.

◆ isPinned()

boolean isPinned ( )
inline

Whether to pin on top

◆ getOrderKey()

long getOrderKey ( )
inline

The field by which conversations are sorted (supported only in 5.5.892 and later)

Attention
  • The field orderKey is a number that increases linearly according to the last active time of conversations. Please note that this is not a timestamp because multiple conversations may be active at the same time.
  • For 5.5.892 and later versions, it is recommended that you sort all conversations by this field. The larger the orderKey value, the higher a conversation will appear on the list.
  • If all conversation messages are cleared or the messages of each conversation are deleted one by one, the lastMessage of the conversations will become empty, but orderKey will not change. Therefore, if you want to keep the sorting of conversations, you can use this field to sort conversations.

◆ getMarkList()

List<Long> getMarkList ( )
inline

Mark list of the conversation(supported only in 6.5 and later versions)

◆ getCustomData()

String getCustomData ( )
inline

Custom data of the conversation(supported only in 6.5 and later versions)

◆ getConversationGroupList()

List<String> getConversationGroupList ( )
inline

The conversation group list to which the conversation belongs.(supported only in 6.5 and later versions)

◆ getC2CReadTimestamp()

long getC2CReadTimestamp ( )
inline

UTC timestamp of the latest message which has been read. Valid only for one-to-one chat.(supported only in 7.1 and later versions)

◆ getGroupReadSequence()

long getGroupReadSequence ( )
inline

Sequence of the latest message which has been read. Valid only for group chat.(supported only in 7.1 and later versions)

Field Documentation

◆ CONVERSATION_TYPE_INVALID

final int CONVERSATION_TYPE_INVALID = 0
static

Invalid type

◆ V2TIM_C2C

final int V2TIM_C2C = 1
static

One-to-one chat

◆ V2TIM_GROUP

final int V2TIM_GROUP = 2
static

Group chat

◆ V2TIM_CONVERSATION_MARK_TYPE_STAR

long V2TIM_CONVERSATION_MARK_TYPE_STAR = 0x1
static

Star a conversation

◆ V2TIM_CONVERSATION_MARK_TYPE_UNREAD

long V2TIM_CONVERSATION_MARK_TYPE_UNREAD = 0x1 << 1
static

Mark a conversation as unread

◆ V2TIM_CONVERSATION_MARK_TYPE_FOLD

long V2TIM_CONVERSATION_MARK_TYPE_FOLD = 0x1 << 2
static

Fold a conversation

◆ V2TIM_CONVERSATION_MARK_TYPE_HIDE

long V2TIM_CONVERSATION_MARK_TYPE_HIDE = 0x1 << 3
static

Hide a conversation