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 ()
 

Static Public Attributes

static final int CONVERSATION_TYPE_INVALID = 0
 
static final int V2TIM_C2C = 1
 
static final int V2TIM_GROUP = 2
 

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 type is one-to-one chat, the userID stores the user ID of the peer; otherwise, the userID is null

Returns
User's userID

◆ getGroupID()

String getGroupID ( )
inline

If the conversation type is group chat, the groupID stores the current group ID; otherwise, the groupID is null

Returns
Group ID

◆ getShowName()

String getShowName ( )
inline

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

  • Group: group name
  • One-to-one: peer's remarks -> peer's nickname -> peer's userID
Returns
Display name

◆ getFaceUrl()

String getFaceUrl ( )
inline

Get the conversation display profile photo

  • Group: group profile photo
  • One-to-one: peer'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
For versions earlier than 5.5.892, please use "lastMessage -> timestamp" to sort conversations. The later the timestamp, the higher the order of the conversation.

◆ getDraftText()

String getDraftText ( )
inline

Get a draft message whose editing is not finished (a draft message is stored locally only and will get lost after the app is uninstalled and reinstalled)

Returns
Return the draft content. If the draft content does not exist or is incorrect, return null

◆ getDraftTimestamp()

long getDraftTimestamp ( )
inline

Get the draft message time

Returns
Time, in seconds

◆ getGroupAtInfoList()

List<V2TIMGroupAtInfo> getGroupAtInfoList ( )
inline

Get the @ information list of a group conversation, which is used to display "someone@me" or "@All" notifications

◆ isPinned()

boolean isPinned ( )
inline

Whether to pin on top

◆ getOrderKey()

long getOrderKey ( )
inline

orderKey (supported only in 5.5.892 and later)

Attention
  • The sorting field orderKey is a number that increases linearly according to the conversation activation time (note: this is not a timestamp because multiple conversations may be activated at the same time).
  • For 5.5.892 and later versions, it is recommended that you use this field to sort all conversations. The larger the orderKey value, the higher the order of the conversation.
  • When you clear all messages in a conversation at a time or delete all messages in the conversation one by one, the lastMessage of the conversation becomes empty, but the orderKey of the conversation will not change. In that case, if you want to keep the sorting positions of conversations unchanged, you can use this field to sort all conversations.

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