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.
V2TIMMessage

Public Member Functions

 V2TIMMessage ()
 
String getMsgID ()
 
long getTimestamp ()
 
String getSender ()
 
String getNickName ()
 
String getFriendRemark ()
 
String getFaceUrl ()
 
String getNameCard ()
 
String getGroupID ()
 
String getUserID ()
 
int getStatus ()
 
int getElemType ()
 
V2TIMTextElem getTextElem ()
 
V2TIMCustomElem getCustomElem ()
 
V2TIMImageElem getImageElem ()
 
V2TIMSoundElem getSoundElem ()
 
V2TIMVideoElem getVideoElem ()
 
V2TIMFileElem getFileElem ()
 
V2TIMLocationElem getLocationElem ()
 
V2TIMFaceElem getFaceElem ()
 
V2TIMMergerElem getMergerElem ()
 
V2TIMGroupTipsElem getGroupTipsElem ()
 
String getLocalCustomData ()
 
void setLocalCustomData (String localCustomData)
 
int getLocalCustomInt ()
 
void setLocalCustomInt (int localCustomInt)
 
void setCloudCustomData (String data)
 
String getCloudCustomData ()
 
boolean isSelf ()
 
boolean isRead ()
 
boolean isPeerRead ()
 
int getPriority ()
 
V2TIMOfflinePushInfo getOfflinePushInfo ()
 
List< String > getGroupAtUserList ()
 
long getSeq ()
 
long getRandom ()
 
boolean isExcludedFromUnreadCount ()
 
void setExcludedFromUnreadCount (boolean excludedFromUnreadCount)
 
boolean isExcludedFromLastMessage ()
 
void setExcludedFromLastMessage (boolean excludedFromLastMessage)
 

Static Public Attributes

static final int V2TIM_MSG_STATUS_SENDING = 1
 
static final int V2TIM_MSG_STATUS_SEND_SUCC = 2
 
static final int V2TIM_MSG_STATUS_SEND_FAIL = 3
 
static final int V2TIM_MSG_STATUS_HAS_DELETED = 4
 
static final int V2TIM_MSG_STATUS_LOCAL_IMPORTED = 5
 
static final int V2TIM_MSG_STATUS_LOCAL_REVOKED = 6
 
static final int V2TIM_PRIORITY_DEFAULT = 0
 
static final int V2TIM_PRIORITY_HIGH = 1
 
static final int V2TIM_PRIORITY_NORMAL = 2
 
static final int V2TIM_PRIORITY_LOW = 3
 
static final int V2TIM_ELEM_TYPE_NONE = 0
 
static final int V2TIM_ELEM_TYPE_TEXT = 1
 
static final int V2TIM_ELEM_TYPE_CUSTOM = 2
 
static final int V2TIM_ELEM_TYPE_IMAGE = 3
 
static final int V2TIM_ELEM_TYPE_SOUND = 4
 
static final int V2TIM_ELEM_TYPE_VIDEO = 5
 
static final int V2TIM_ELEM_TYPE_FILE = 6
 
static final int V2TIM_ELEM_TYPE_LOCATION = 7
 
static final int V2TIM_ELEM_TYPE_FACE = 8
 
static final int V2TIM_ELEM_TYPE_GROUP_TIPS = 9
 
static final int V2TIM_ELEM_TYPE_MERGER = 10
 
static final int V2TIM_RECEIVE_MESSAGE = 0
 
static final int V2TIM_NOT_RECEIVE_MESSAGE = 1
 
static final int V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE = 2
 

Constructor & Destructor Documentation

◆ V2TIMMessage()

V2TIMMessage ( )
inline

Member Function Documentation

◆ getMsgID()

String getMsgID ( )
inline

Get the message ID

Returns

◆ getTimestamp()

long getTimestamp ( )
inline

Get the message timestamp

Returns

◆ getSender()

String getSender ( )
inline

Get the userID of the message sender

Returns
Sender's userID

◆ getNickName()

String getNickName ( )
inline

Get the nickname of the message sender

Returns
Sender's nickname

◆ getFriendRemark()

String getFriendRemark ( )
inline

Get friend remarks. If you have not pulled the friend information or are not a friend, null is returned.

Returns
Friend remarks

◆ getFaceUrl()

String getFaceUrl ( )
inline

Get the sender's profile photo URL

Returns
Profile photo URL

◆ getNameCard()

String getNameCard ( )
inline

For a group message, nameCard is the group name card of the sender.

Returns
Group name card

◆ getGroupID()

String getGroupID ( )
inline

For a group message, groupID is the message receiving group ID. Otherwise, groupID is null.

Returns
Group ID

◆ getUserID()

String getUserID ( )
inline

For a one-to-one message, userID is the conversation user ID. Otherwise, userID is null. Suppose you are chatting with userA, regardless of whether it is a message sent to userA by yourself or a message sent to yourself by userA, the userID here is userA.

Returns

◆ getStatus()

int getStatus ( )
inline

Query the message status

Returns
Message sending status

◆ getElemType()

int getElemType ( )
inline

Message type

◆ getTextElem()

V2TIMTextElem getTextElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_TEXT, textElem stores the content of the text message.

◆ getCustomElem()

V2TIMCustomElem getCustomElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_CUSTOM, customElem stores the content of the custom message.

◆ getImageElem()

V2TIMImageElem getImageElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_IMAGE, imageElem stores the content of the image message.

◆ getSoundElem()

V2TIMSoundElem getSoundElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_SOUND, soundElem stores the content of the voice message.

◆ getVideoElem()

V2TIMVideoElem getVideoElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_VIDEO, videoElem stores the content of the video message.

◆ getFileElem()

V2TIMFileElem getFileElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_FILE, fileElem stores the content of the file message.

◆ getLocationElem()

V2TIMLocationElem getLocationElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_LOCATION, locationElem stores the content of the geographical location message.

◆ getFaceElem()

V2TIMFaceElem getFaceElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_FACE, faceElem stores the content of the emoji message.

◆ getMergerElem()

V2TIMMergerElem getMergerElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_RELAY, relayElem stores the content of the forward message.

◆ getGroupTipsElem()

V2TIMGroupTipsElem getGroupTipsElem ( )
inline

If the message type is V2TIM_ELEM_TYPE_GROUP_TIPS, groupTipsElem stores the content of the group tip message.

◆ getLocalCustomData()

String getLocalCustomData ( )
inline

Get custom message data (saved locally, will not be sent to the peer end, and will become invalid after the app is uninstalled and reinstalled)

Returns

◆ setLocalCustomData()

void setLocalCustomData ( String  localCustomData)
inline

Set custom message data (saved locally, will not be sent to the peer end, and will become invalid after the app is uninstalled and reinstalled)

Parameters
localCustomData

◆ getLocalCustomInt()

int getLocalCustomInt ( )
inline

Get custom message data (saved locally, will not be sent to the peer end, and will become invalid after the app is uninstalled and reinstalled)

Returns

◆ setLocalCustomInt()

void setLocalCustomInt ( int  localCustomInt)
inline

Set custom message data and can be used to mark whether a voice or video message is played (saved locally, will not be sent to the peer end, and will become invalid after the app is uninstalled and reinstalled)

Parameters
localCustomInt

◆ setCloudCustomData()

void setCloudCustomData ( String  data)
inline

Set cloud custom data (saved in the cloud, will be sent to the peer end, and can still be pulled after the app is uninstalled and reinstalled)

◆ getCloudCustomData()

String getCloudCustomData ( )
inline

Get cloud custom data

◆ isSelf()

boolean isSelf ( )
inline

Whether the message sender is the current user

◆ isRead()

boolean isRead ( )
inline

Whether the message is read by the current user

◆ isPeerRead()

boolean isPeerRead ( )
inline

Whether the message is read by the peer party (valid only for one-to-one messages)

◆ getPriority()

int getPriority ( )
inline

Message priority

◆ getOfflinePushInfo()

V2TIMOfflinePushInfo getOfflinePushInfo ( )
inline

Offline push information of the message

◆ getGroupAtUserList()

List<String> getGroupAtUserList ( )
inline

◆ getSeq()

long getSeq ( )
inline

Sequence number of the message

Message sequence numbers in group chats are generated in the cloud and are strictly incremented and unique within the group. Message sequence numbers in one-to-one chats are generated locally and cannot be guaranteed to be strictly incremented and unique.

Returns

◆ getRandom()

long getRandom ( )
inline

Random number of the message

◆ isExcludedFromUnreadCount()

boolean isExcludedFromUnreadCount ( )
inline

Get whether the message is excluded from the conversation unread message count

Supported only in 5.3.425 and later versions.

Returns
true: excluded from the conversation unread message count; false: included in the conversation unread message count

◆ setExcludedFromUnreadCount()

void setExcludedFromUnreadCount ( boolean  excludedFromUnreadCount)
inline

Whether the message is excluded from the conversation unread message count. false (default): included in the unread message count of the conversation; true: excluded from the conversation unread message count

Supported only in 5.3.425 and later versions.

◆ isExcludedFromLastMessage()

boolean isExcludedFromLastMessage ( )
inline

Get whether the message is excluded from the conversation lastMessage

Supported only in 5.4.666 and later versions.

Returns
true: excluded from lastMessage; false: included in lastMessage

◆ setExcludedFromLastMessage()

void setExcludedFromLastMessage ( boolean  excludedFromLastMessage)
inline

Whether the message is excluded from the conversation lastMessage. false (default): included in the conversation lastMessage; true: excluded from the conversation lastMessage

Supported only in 5.4.666 and later versions.

Field Documentation

◆ V2TIM_MSG_STATUS_SENDING

final int V2TIM_MSG_STATUS_SENDING = 1
static

Message being sent

◆ V2TIM_MSG_STATUS_SEND_SUCC

final int V2TIM_MSG_STATUS_SEND_SUCC = 2
static

Message sent successfully

◆ V2TIM_MSG_STATUS_SEND_FAIL

final int V2TIM_MSG_STATUS_SEND_FAIL = 3
static

Message fails to be sent

◆ V2TIM_MSG_STATUS_HAS_DELETED

final int V2TIM_MSG_STATUS_HAS_DELETED = 4
static

Message deleted

◆ V2TIM_MSG_STATUS_LOCAL_IMPORTED

final int V2TIM_MSG_STATUS_LOCAL_IMPORTED = 5
static

Message imported to local storage

◆ V2TIM_MSG_STATUS_LOCAL_REVOKED

final int V2TIM_MSG_STATUS_LOCAL_REVOKED = 6
static

Message revoked

◆ V2TIM_PRIORITY_DEFAULT

final int V2TIM_PRIORITY_DEFAULT = 0
static

Defaulted to normal priority

◆ V2TIM_PRIORITY_HIGH

final int V2TIM_PRIORITY_HIGH = 1
static

High priority, usually used for important messages such as gift messages

◆ V2TIM_PRIORITY_NORMAL

final int V2TIM_PRIORITY_NORMAL = 2
static

Normal priority, usually used for common messages

◆ V2TIM_PRIORITY_LOW

final int V2TIM_PRIORITY_LOW = 3
static

Low priority, usually used for like messages

◆ V2TIM_ELEM_TYPE_NONE

final int V2TIM_ELEM_TYPE_NONE = 0
static

No element

◆ V2TIM_ELEM_TYPE_TEXT

final int V2TIM_ELEM_TYPE_TEXT = 1
static

Text message

◆ V2TIM_ELEM_TYPE_CUSTOM

final int V2TIM_ELEM_TYPE_CUSTOM = 2
static

Custom message

◆ V2TIM_ELEM_TYPE_IMAGE

final int V2TIM_ELEM_TYPE_IMAGE = 3
static

Image message

◆ V2TIM_ELEM_TYPE_SOUND

final int V2TIM_ELEM_TYPE_SOUND = 4
static

Voice message

◆ V2TIM_ELEM_TYPE_VIDEO

final int V2TIM_ELEM_TYPE_VIDEO = 5
static

Video message

◆ V2TIM_ELEM_TYPE_FILE

final int V2TIM_ELEM_TYPE_FILE = 6
static

File message

◆ V2TIM_ELEM_TYPE_LOCATION

final int V2TIM_ELEM_TYPE_LOCATION = 7
static

Geographical location message

◆ V2TIM_ELEM_TYPE_FACE

final int V2TIM_ELEM_TYPE_FACE = 8
static

Emoji message

◆ V2TIM_ELEM_TYPE_GROUP_TIPS

final int V2TIM_ELEM_TYPE_GROUP_TIPS = 9
static

Group tip message (saved in a message list)

◆ V2TIM_ELEM_TYPE_MERGER

final int V2TIM_ELEM_TYPE_MERGER = 10
static

Forward message

◆ V2TIM_RECEIVE_MESSAGE

final int V2TIM_RECEIVE_MESSAGE = 0
static

Messages will be received when the user is online, and offline push notifications will be received when the user is offline

◆ V2TIM_NOT_RECEIVE_MESSAGE

final int V2TIM_NOT_RECEIVE_MESSAGE = 1
static

No message will be received

◆ V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE

final int V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE = 2
static

Messages will be received when the user is online, and no push notification will be received when the user is offline