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 ()
 
boolean isNeedReadReceipt ()
 
void setNeedReadReceipt (boolean needReadReceipt)
 
boolean isBroadcastMessage ()
 
int getPriority ()
 
V2TIMOfflinePushInfo getOfflinePushInfo ()
 
List< String > getGroupAtUserList ()
 
long getSeq ()
 
long getRandom ()
 
boolean isExcludedFromUnreadCount ()
 
void setExcludedFromUnreadCount (boolean excludedFromUnreadCount)
 
boolean isExcludedFromLastMessage ()
 
void setExcludedFromLastMessage (boolean excludedFromLastMessage)
 
boolean isExcludedFromContentModeration ()
 
void setExcludedFromContentModeration (boolean excludedFromContentModeration)
 
String getCustomModerationConfigurationID ()
 
void setCustomModerationConfigurationID (String customModerationConfigurationID)
 
boolean isSupportMessageExtension ()
 
void setSupportMessageExtension (boolean supportExtension)
 
boolean hasRiskContent ()
 
V2TIMUserFullInfo getRevokerInfo ()
 
String getRevokeReason ()
 
String toString ()
 

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
 
static final int V2TIM_GROUP_MESSAGE_READ_MEMBERS_FILTER_READ = 0
 
static final int V2TIM_GROUP_MESSAGE_READ_MEMBERS_FILTER_UNREAD = 1
 

Constructor & Destructor Documentation

◆ V2TIMMessage()

V2TIMMessage ( )
inline

Member Function Documentation

◆ getMsgID()

String getMsgID ( )
inline

Get the message ID

Returns

◆ getTimestamp()

long getTimestamp ( )
inline

Get UTC timestamp of the message

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

The condition for this field to be YES is that the message timestamp <= the time when the peer marked conversation as read

◆ isNeedReadReceipt()

boolean isNeedReadReceipt ( )
inline

Before using this function in group messages, you need to go to the IM console to set the group type supported by read receipts

◆ setNeedReadReceipt()

void setNeedReadReceipt ( boolean  needReadReceipt)
inline

Whether a read receipt is required

Attention

This feature for group chats is supported in 6.1 and later version. And you need to go to the IM console to enable this feature for specific group type.

This feature for one-to-one chats is supported in 6.2 and later version.

You need to buy Flagship Edition to use this feature for both group and one-to-one chats.

◆ isBroadcastMessage()

boolean isBroadcastMessage ( )
inline

Whether the message is a kind of broadcast message.

Only supported in AVChatRoom.

Only supported in 6.5 and later versions and need to buy Flagship Edition

◆ 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. Meeting group does not support this field by default.

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

◆ isExcludedFromContentModeration()

boolean isExcludedFromContentModeration ( )
inline

Get whether the current message will be excluded from content moderation(including [Local moderation] and [Cloud moderation]).

Supported only in 7.1 and later versions.

Valid only after the [Local Moderation] or [Cloud Moderation] function is activated.

Returns
true: will be excluded from content moderation; false: will not be excluded from content moderation.

◆ setExcludedFromContentModeration()

void setExcludedFromContentModeration ( boolean  excludedFromContentModeration)
inline

Specify Whether the current message will be excluded from content moderation(including [Local moderation] and [Cloud moderation]). Its default value is false.

Supported only in 7.1 and later versions.

Valid only after the [Local Moderation] or [Cloud Moderation] function is activated.

[Local moderation] please refer to document local moderation function.

[Cloud moderation] please refer to document cloud moderation function

◆ getCustomModerationConfigurationID()

String getCustomModerationConfigurationID ( )
inline

Get custom moderation configuration ID

◆ setCustomModerationConfigurationID()

void setCustomModerationConfigurationID ( String  customModerationConfigurationID)
inline

Set custom moderation configuration ID (supported only in 7.8 and later versions) Valid only after the [Cloud Moderation] function is activated. You can go to the Console (Cloud moderation -> Moderation configuration -> Custom configuration -> Add custom configuration) to get the configuration ID. [Custom moderation] please refer to document cloud moderation function

Attention
This field needs to be set up before sending messages. It is only used to control the the message moderation when sending messages, Its value will not be stored in cloud and local.

◆ isSupportMessageExtension()

boolean isSupportMessageExtension ( )
inline

Whether to support message extension (supported only in 6.7 and later versions)

◆ setSupportMessageExtension()

void setSupportMessageExtension ( boolean  supportExtension)
inline

Set whether support message extension (supported only in 6.7 and later versions)

Attention

AVChatRoom message do not support this feature.

You need to go to the IM console to enable this feature.

You need to buy Flagship Edition to use this feature.

◆ hasRiskContent()

boolean hasRiskContent ( )
inline

Whether the current message is identified as risk message (supported only in 7.4 and later versions)

Attention

Only messages containing sound and video are supported.

It will take effect after you enabling the [Cloud Moderation] feauture, [Cloud Moderation] please refer to document cloud moderation function.

If you send a risky sound or video message, you will receive the onRecvMessageModified callback with this field being set to true after the cloud moderation.

◆ getRevokerInfo()

V2TIMUserFullInfo getRevokerInfo ( )
inline

Get revoker's info (supported only in imsdk 7.4 and later versions)

Returns
Revoker's info
Attention
Valid only for revoked message

◆ getRevokeReason()

String getRevokeReason ( )
inline

Get revoke reason (supported only in imsdk 7.4 and later versions)

Returns
Revoke reason
Attention
Valid only for revoked message

◆ toString()

String toString ( )
inline

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

◆ V2TIM_GROUP_MESSAGE_READ_MEMBERS_FILTER_READ

final int V2TIM_GROUP_MESSAGE_READ_MEMBERS_FILTER_READ = 0
static

Group message read member list

◆ V2TIM_GROUP_MESSAGE_READ_MEMBERS_FILTER_UNREAD

final int V2TIM_GROUP_MESSAGE_READ_MEMBERS_FILTER_UNREAD = 1
static

Group message unread member list