Chat SDK for Android v1.1.0
agora java chat SDK
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
io.agora.chat.ChatMessage Class Reference
Inheritance diagram for io.agora.chat.ChatMessage:

Classes

enum  ChatRoomMessagePriority
 
enum  ChatType
 
enum  Direct
 
class  EMCallbackHolder
 
enum  Status
 
enum  Type
 

Public Member Functions

Status status ()
 
 ChatMessage (EMAMessage message)
 
void setStatus (Status status)
 
Type getType ()
 
MessageBody getBody ()
 
long getMsgTime ()
 
void setMsgTime (long msgTime)
 
long localTime ()
 
void setLocalTime (long serverTime)
 
boolean isNeedGroupAck ()
 
void setIsNeedGroupAck (boolean need)
 
int groupAckCount ()
 
void setGroupAckCount (int count)
 
void setIsChatThreadMessage (boolean isChatThreadMessage)
 
boolean isChatThreadMessage ()
 
ChatThread getChatThread ()
 
void setBody (MessageBody body)
 
void addBody (MessageBody body)
 
String getFrom ()
 
void setFrom (String from)
 
String getRecaller ()
 
void setTo (String to)
 
String getTo ()
 
String getMsgId ()
 
void setMsgId (String msgId)
 
synchronized void setMessageStatusCallback (CallBack callback)
 
String toString ()
 
void setAttribute (String attribute, boolean value)
 
void setAttribute (String attribute, int value)
 
void setAttribute (String attribute, long value)
 
void setAttribute (String attribute, float value)
 
void setAttribute (String attribute, double value)
 
void setAttribute (String attribute, JSONObject value)
 
void setAttribute (String attribute, JSONArray value)
 
void setAttribute (String attribute, String value)
 
boolean getBooleanAttribute (String attribute) throws ChatException
 
boolean getBooleanAttribute (String attribute, boolean defaultValue)
 
int getIntAttribute (String attribute, int defaultValue)
 
long getLongAttribute (String attribute, long defaultValue)
 
float getFloatAttribute (String attribute, float defaultValue)
 
double getDoubleAttribute (String attribute, double defaultValue)
 
int getIntAttribute (String attribute) throws ChatException
 
long getLongAttribute (String attribute) throws ChatException
 
float getFloatAttribute (String attribute) throws ChatException
 
double getDoubleAttribute (String attribute) throws ChatException
 
String getStringAttribute (String attribute) throws ChatException
 
String getStringAttribute (String attribute, String defaultValue)
 
JSONObject getJSONObjectAttribute (String attribute) throws ChatException
 
JSONArray getJSONArrayAttribute (String attribute) throws ChatException
 
ChatType getChatType ()
 
void setChatType (ChatType chatType)
 
int describeContents ()
 
void writeToParcel (Parcel out, int flags)
 
Object clone () throws CloneNotSupportedException
 
boolean isAcked ()
 
void setAcked (boolean isAcked)
 
boolean isDelivered ()
 
void setDelivered (boolean isDelivered)
 
boolean isUnread ()
 
void setUnread (boolean unread)
 
boolean isListened ()
 
void setListened (boolean isListened)
 
String getUserName ()
 
void setDeliverAcked (boolean isDeliverAcked)
 
int progress ()
 
void setProgress (int progress)
 
Direct direct ()
 
void setDirection (Direct dir)
 
String conversationId ()
 
Map< String, Object > ext ()
 
List< MessageReactiongetMessageReaction ()
 
boolean isOnlineState ()
 
void setPriority (ChatRoomMessagePriority priority)
 

Static Public Member Functions

static ChatMessage createSendMessage (Type type)
 
static ChatMessage createReceiveMessage (Type type)
 
static ChatMessage createTxtSendMessage (String content, String username)
 
static ChatMessage createTextSendMessage (String content, String username)
 
static ChatMessage createVoiceSendMessage (String filePath, int timeLength, String username)
 
static ChatMessage createVoiceSendMessage (Uri filePath, int timeLength, String username)
 
static ChatMessage createImageSendMessage (String filePath, boolean sendOriginalImage, String username)
 
static ChatMessage createImageSendMessage (Uri imgUri, boolean sendOriginalImage, String username)
 
static ChatMessage createVideoSendMessage (String videofilePath, String imageThumbPath, int timeLength, String username)
 
static ChatMessage createVideoSendMessage (Uri videofilePath, String imageThumbPath, int timeLength, String username)
 
static ChatMessage createVideoSendMessage (Uri videofilePath, Uri imageThumbPath, int timeLength, String username)
 
static ChatMessage createLocationSendMessage (double latitude, double longitude, String locationAddress, String buildingName, String username)
 
static ChatMessage createLocationSendMessage (double latitude, double longitude, String locationAddress, String username)
 
static ChatMessage createFileSendMessage (String filePath, String username)
 
static ChatMessage createFileSendMessage (Uri filePath, String username)
 

Static Public Attributes

static final Parcelable.Creator< ChatMessageCREATOR
 

Detailed Description

The message instance, which indicates a sent or received message.

For example: Constructs a text message to send:

ChatMessage msg = ChatMessage.createSendMessage(ChatMessage.Type.TXT);
msg.setTo("user1");
TextMessageBody body = new TextMessageBody("hello from hyphenate sdk");
msg.addBody(body);

Constructs an image message to send:

ChatMessage msg = ChatMessage.createSendMessage(ChatMessage.Type.IMAGE);
msg.setTo("user1");
ImageMessageBody body = new ImageMessageBody(imageFileUrl);
msg.addBody(body);

Member Function Documentation

◆ addBody()

void io.agora.chat.ChatMessage.addBody ( MessageBody  body)

Adds a message body.

This method is equivalent to ChatMessage#setBody(MessageBody) which sets the message body. The latter is recommended.

Only one message body can be added for one message.

Parameters
bodyThe message body.

◆ conversationId()

String io.agora.chat.ChatMessage.conversationId ( )

Gets the conversation ID.

Returns
The conversation ID.

◆ createFileSendMessage() [1/2]

static ChatMessage io.agora.chat.ChatMessage.createFileSendMessage ( String  filePath,
String  username 
)
static

Creates a file message for sending.

Parameters
filePathThe file path.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createFileSendMessage() [2/2]

static ChatMessage io.agora.chat.ChatMessage.createFileSendMessage ( Uri  filePath,
String  username 
)
static

Creates a file message for sending.

Parameters
filePathThe file path.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createImageSendMessage() [1/2]

static ChatMessage io.agora.chat.ChatMessage.createImageSendMessage ( String  filePath,
boolean  sendOriginalImage,
String  username 
)
static

Creates an image message for sending.

Parameters
filePathThe image path.
sendOriginalImageWhether to send the original image.
  • true: Yes.
  • false: If the image is smaller than 100 KB, the SDK sends the original image. If the image is equal to or greater than 100 KB, the SDK will compress it before sending the compressed image.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createImageSendMessage() [2/2]

static ChatMessage io.agora.chat.ChatMessage.createImageSendMessage ( Uri  imgUri,
boolean  sendOriginalImage,
String  username 
)
static

Creates an image message for sending.

Parameters
imgUriThe URI of the image.
sendOriginalImageWhether to send the original image.
  • true: Yes.
  • false: If the image is smaller than 100 KB, the SDK sends the original image. If the image is equal to or greater than 100 KB, the SDK will compress it before sending the compressed image.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createLocationSendMessage() [1/2]

static ChatMessage io.agora.chat.ChatMessage.createLocationSendMessage ( double  latitude,
double  longitude,
String  locationAddress,
String  buildingName,
String  username 
)
static

Creates a location message for sending.

Parameters
latitudeThe latitude.
longitudeThe longitude.
locationAddressThe location details.
buildingNameThe name of the building.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createLocationSendMessage() [2/2]

static ChatMessage io.agora.chat.ChatMessage.createLocationSendMessage ( double  latitude,
double  longitude,
String  locationAddress,
String  username 
)
static

Creates a location message for sending.

Parameters
latitudeThe latitude.
longitudeThe longitude.
locationAddressThe location details.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createReceiveMessage()

static ChatMessage io.agora.chat.ChatMessage.createReceiveMessage ( Type  type)
static

Creates a received message instance.

Parameters
typeThe message type.
Returns
The message instance.

◆ createSendMessage()

static ChatMessage io.agora.chat.ChatMessage.createSendMessage ( Type  type)
static

Creates a message instance for sending.

Parameters
typeThe message type.
Returns
The message instance.

◆ createTextSendMessage()

static ChatMessage io.agora.chat.ChatMessage.createTextSendMessage ( String  content,
String  username 
)
static

Creates a text message for sending.

Parameters
contentThe text content.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createTxtSendMessage()

static ChatMessage io.agora.chat.ChatMessage.createTxtSendMessage ( String  content,
String  username 
)
static

Creates a text message for sending.

Parameters
contentThe text content.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.
Deprecated:
Deprecated. Use createTextSendMessage(String, String) instead.

◆ createVideoSendMessage() [1/3]

static ChatMessage io.agora.chat.ChatMessage.createVideoSendMessage ( String  videofilePath,
String  imageThumbPath,
int  timeLength,
String  username 
)
static

Creates a video message for sending.

Parameters
videofilePathThe path of the video file.
imageThumbPathThe path of thumbnail of the first frame of the video.
timeLengthThe video duration in seconds.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createVideoSendMessage() [2/3]

static ChatMessage io.agora.chat.ChatMessage.createVideoSendMessage ( Uri  videofilePath,
String  imageThumbPath,
int  timeLength,
String  username 
)
static

Creates a video message for sending.

Parameters
videofilePathThe path of the video file.
imageThumbPathThe path of the thumbnail of the first frame of the video.
timeLengthThe video duration in seconds.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createVideoSendMessage() [3/3]

static ChatMessage io.agora.chat.ChatMessage.createVideoSendMessage ( Uri  videofilePath,
Uri  imageThumbPath,
int  timeLength,
String  username 
)
static

Creates a video message for sending.

Parameters
videofilePathThe path of the video file.
imageThumbPathThe path of the thumbnail of the first frame of the video.
timeLengthThe video duration in seconds.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createVoiceSendMessage() [1/2]

static ChatMessage io.agora.chat.ChatMessage.createVoiceSendMessage ( String  filePath,
int  timeLength,
String  username 
)
static

Creates a voice message for sending.

Parameters
filePathThe path of the voice file.
timeLengthThe voice duration in seconds.
usernameThe user ID of the message recipient or the group ID.
Returns
The message instance.

◆ createVoiceSendMessage() [2/2]

static ChatMessage io.agora.chat.ChatMessage.createVoiceSendMessage ( Uri  filePath,
int  timeLength,
String  username 
)
static

Creates a voice message for sending.

Parameters
filePathThe URI of the voice file.
timeLengthThe voice duration in seconds.
usernameThe user ID of the message recipient or group ID.
Returns
The message instance.

◆ direct()

Direct io.agora.chat.ChatMessage.direct ( )

The message direction.

  • SEND: This message is sent from the local client.
  • RECEIVE: The message is received by the local client.
Returns
The message direction. See Direct.

◆ ext()

Map< String, Object > io.agora.chat.ChatMessage.ext ( )

Gets all message extension fields. The return type is Map<String, Object>.

Returns
All message extension fields which are returned as a Map collection, Map<String, Object>. The Map collection contains key-value pairs where the key is the type (Boolean, Integer, Long, Float, Double, or String) of the extension field, and the value is the name of the extension field. If JsonObject is passed as the extension field type, it is returned as String.

Returns the message's extension. The return type is Map<String, Object>. The object can be Boolean, Integer, Long, Float, Double, String. If the input is JsonObject or JsonArray, which use setAttribute(String attribute, JSONObject json) to passed in, the Map.Entry.value type is String.

◆ getBody()

MessageBody io.agora.chat.ChatMessage.getBody ( )

Gets the message body.

Returns
The message body.

◆ getBooleanAttribute() [1/2]

boolean io.agora.chat.ChatMessage.getBooleanAttribute ( String  attribute) throws ChatException

Gets a message extension attribute of the Bool type.

Parameters
attributeThe attribute name.
Returns
The attribute value.
Exceptions
ChatExceptionA description of the exception. See io.agora.Error.

◆ getBooleanAttribute() [2/2]

boolean io.agora.chat.ChatMessage.getBooleanAttribute ( String  attribute,
boolean  defaultValue 
)

Gets a message extension attribute of the Bool type.

Parameters
attributeThe attribute name.
defaultValueThe default value of the attribute.
Returns
The attribute value.

◆ getChatThread()

ChatThread io.agora.chat.ChatMessage.getChatThread ( )

Gets the overview of the message thread.

The overview of the message thread exists only after you creates a message thread.

Returns
The overview of the message thread.

◆ getChatType()

ChatType io.agora.chat.ChatMessage.getChatType ( )

Gets the chat type.

Returns
The chat type.

◆ getDoubleAttribute() [1/2]

double io.agora.chat.ChatMessage.getDoubleAttribute ( String  attribute) throws ChatException

Gets a message extension attribute of the double type.

Parameters
attributeThe attribute name.
Returns
The attribute value.
Exceptions
ChatExceptionA description of the exception. See io.agora.Error.

◆ getDoubleAttribute() [2/2]

double io.agora.chat.ChatMessage.getDoubleAttribute ( String  attribute,
double  defaultValue 
)

Gets a message extension attribute of the Double type.

Parameters
attributeThe attribute name.
defaultValueThe default value of the attribute.
Returns
The attribute value.

◆ getFloatAttribute() [1/2]

float io.agora.chat.ChatMessage.getFloatAttribute ( String  attribute) throws ChatException

Gets a message extension attribute of the Float type.

Parameters
attributeThe attribute name.
Returns
The attribute value.
Exceptions
ChatExceptionA description of the exception. See io.agora.Error.

◆ getFloatAttribute() [2/2]

float io.agora.chat.ChatMessage.getFloatAttribute ( String  attribute,
float  defaultValue 
)

Gets a message extension attribute of the Float type.

Parameters
attributeThe attribute name.
defaultValueThe default value of the attribute.
Returns
The attribute value.

◆ getFrom()

String io.agora.chat.ChatMessage.getFrom ( )

Gets the user ID of the message sender.

Returns
The user ID of the message sender.

◆ getIntAttribute() [1/2]

int io.agora.chat.ChatMessage.getIntAttribute ( String  attribute) throws ChatException

Gets a message extension attribute of the Int type.

Parameters
attributeThe attribute name.
Returns
The attribute value.
Exceptions
ChatExceptionA description of the exception. See io.agora.Error.

◆ getIntAttribute() [2/2]

int io.agora.chat.ChatMessage.getIntAttribute ( String  attribute,
int  defaultValue 
)

Gets a message extension attribute of the Int type.

Parameters
attributeThe attribute name.
defaultValueThe default value of the attribute.
Returns
The attribute value.

◆ getJSONArrayAttribute()

JSONArray io.agora.chat.ChatMessage.getJSONArrayAttribute ( String  attribute) throws ChatException

Gets a message extension attribute of the JSONArray type.

Parameters
attributeThe attribute name.
Returns
The attribute value.
Exceptions
ChatExceptionA description of the exception. See io.agora.Error.

◆ getJSONObjectAttribute()

JSONObject io.agora.chat.ChatMessage.getJSONObjectAttribute ( String  attribute) throws ChatException

Gets a message extension attribute of the JSONObject type.

Parameters
attributeThe attribute name.
Returns
The attribute value.
Exceptions
ChatExceptionA description of the exception. See io.agora.Error.

◆ getLongAttribute() [1/2]

long io.agora.chat.ChatMessage.getLongAttribute ( String  attribute) throws ChatException

Gets a message extension attribute of the Long type.

Parameters
attributeThe attribute name.
Returns
The attribute value.
Exceptions
ChatExceptionA description of the exception. See io.agora.Error.

◆ getLongAttribute() [2/2]

long io.agora.chat.ChatMessage.getLongAttribute ( String  attribute,
long  defaultValue 
)

Gets a message extension attribute of the Long type.

Parameters
attributeThe attribute name.
defaultValueThe default value of the attribute.
Returns
The attribute value.

◆ getMessageReaction()

List< MessageReaction > io.agora.chat.ChatMessage.getMessageReaction ( )

Gets the list of Reactions.

Returns
The list of Reactions.

◆ getMsgId()

String io.agora.chat.ChatMessage.getMsgId ( )

Gets the message ID.

Returns
The message ID.

◆ getMsgTime()

long io.agora.chat.ChatMessage.getMsgTime ( )

Gets the Unix timestamp when the server receives the message.

Returns
The Unix timestamp when the server receives the message.

◆ getRecaller()

String io.agora.chat.ChatMessage.getRecaller ( )

Gets the ID of the user that recalls the message.

Returns
The ID of the user that recalls the message.

◆ getStringAttribute() [1/2]

String io.agora.chat.ChatMessage.getStringAttribute ( String  attribute) throws ChatException

Gets a message extension attribute of the String type.

Parameters
attributeThe attribute name.
Returns
The attribute value.
Exceptions
ChatExceptionA description of the exception. See io.agora.Error.

◆ getStringAttribute() [2/2]

String io.agora.chat.ChatMessage.getStringAttribute ( String  attribute,
String  defaultValue 
)

Gets a message extension attribute of the String type.

Parameters
attributeThe attribute name.
defaultValueThe default value of the attribute.
Returns
The attribute value.

◆ getTo()

String io.agora.chat.ChatMessage.getTo ( )

Gets the user ID of the message recipient.

Returns
The user ID of the message recipient.

◆ getType()

Type io.agora.chat.ChatMessage.getType ( )

Gets the chat message type.

Returns
The chat message type.

◆ getUserName()

String io.agora.chat.ChatMessage.getUserName ( )

Gets the user ID of the other party:

  • One-to-one chat: The user ID of the peer user.
  • Group chat: The group ID.
  • Chat room chat: The chat room ID.
Returns
The user ID of the peer user.

◆ groupAckCount()

int io.agora.chat.ChatMessage.groupAckCount ( )

Gets the number of members that have read the group message.

Returns
The number of members that have read the group message.

◆ isAcked()

boolean io.agora.chat.ChatMessage.isAcked ( )

Gets whether the message is read.

Returns
whether the message is read: -true: Yes. -false: No.

◆ isChatThreadMessage()

boolean io.agora.chat.ChatMessage.isChatThreadMessage ( )

Gets whether the message is a threaded message.

Returns
Whether the message is a threaded message.
  • true: Yes.
  • false: No.

◆ isDelivered()

boolean io.agora.chat.ChatMessage.isDelivered ( )

Gets whether the message is successfully delivered.

Returns
Whether the message is successfully delivered: -true: Yes. -false: No.

◆ isListened()

boolean io.agora.chat.ChatMessage.isListened ( )

Gets whether the voice message is listened.

Returns
Whether the voice message is listened:
  • true: Yes.
  • false: No.

◆ isNeedGroupAck()

boolean io.agora.chat.ChatMessage.isNeedGroupAck ( )

Sets whether read receipts are required for group messages.

Returns
Whether read receipts are required for group messages:
  • true: Yes;
  • false: No.

◆ isOnlineState()

boolean io.agora.chat.ChatMessage.isOnlineState ( )

Whether the message gets delivered to an online user.

Note
This field is issued by the server to indicate whether the recipient is online when the message is delivered.

This field is not stored in the local database. The value of this field is true by default for messages read from the database or pulled from the server.

Returns
Whether the recipient is online when the message is delivered.
  • (Default)true: Yes.
  • false: No. The recipient is offline.

◆ isUnread()

boolean io.agora.chat.ChatMessage.isUnread ( )

Checks whether the message is unread.

Returns
Whether the message is unread. -true: Yes. -false: No.

◆ localTime()

long io.agora.chat.ChatMessage.localTime ( )

Gets the local timestamp of the message.

This method gets the timestamp when the message is created locally.

Returns
The local timestamp of the message.

◆ progress()

int io.agora.chat.ChatMessage.progress ( )

The progress for uploading or downloading a message attachment.

The upload or download progress is unavailable for the thumbnail of the message attachments.

Returns
The progress for uploading or downloading the message attachment. The value range is [0,100].

◆ setAcked()

void io.agora.chat.ChatMessage.setAcked ( boolean  isAcked)

Sets whether the message is read.

The method is supposed to be called by the SDK instead of you.

Parameters
isAckedWhether the message is read: -true: Yes. -false: No.

◆ setAttribute() [1/8]

void io.agora.chat.ChatMessage.setAttribute ( String  attribute,
boolean  value 
)

Sets a message extension attribute of the Bool type.

Parameters
attributeThe attribute name.
valueThe attribute value.

◆ setAttribute() [2/8]

void io.agora.chat.ChatMessage.setAttribute ( String  attribute,
double  value 
)

Sets a message extension attribute of the Double type.

Parameters
attributeThe attribute name.
valueThe attribute value.

◆ setAttribute() [3/8]

void io.agora.chat.ChatMessage.setAttribute ( String  attribute,
float  value 
)

Sets a message extension attribute of the Float type.

Parameters
attributeThe attribute name.
valueThe attribute value.

◆ setAttribute() [4/8]

void io.agora.chat.ChatMessage.setAttribute ( String  attribute,
int  value 
)

Sets a message extension attribute of the Int type.

Parameters
attributeThe attribute name.
valueThe attribute value.

◆ setAttribute() [5/8]

void io.agora.chat.ChatMessage.setAttribute ( String  attribute,
JSONArray  value 
)

Sets a message extension attribute of the JSONArray type.

Parameters
attributeThe attribute name.
valueThe attribute value.

◆ setAttribute() [6/8]

void io.agora.chat.ChatMessage.setAttribute ( String  attribute,
JSONObject  value 
)

Sets a message extension attribute of the JSONObject type.

Parameters
attributeThe attribute name.
valueThe attribute value.

◆ setAttribute() [7/8]

void io.agora.chat.ChatMessage.setAttribute ( String  attribute,
long  value 
)

Sets a message extension attribute of the Long type.

Parameters
attributeThe attribute name.
valueThe attribute value.

◆ setAttribute() [8/8]

void io.agora.chat.ChatMessage.setAttribute ( String  attribute,
String  value 
)

Sets a message extension attribute of the String type.

Parameters
attributeThe attribute name.
valueThe attribute value.

◆ setBody()

void io.agora.chat.ChatMessage.setBody ( MessageBody  body)

(Recommended)Sets the message body.

Parameters
bodyThe message body.

◆ setChatType()

void io.agora.chat.ChatMessage.setChatType ( ChatType  chatType)

Sets the chat type.

Parameters
chatTypeThe chat type. See ChatType.

◆ setDeliverAcked()

void io.agora.chat.ChatMessage.setDeliverAcked ( boolean  isDeliverAcked)

Sets the message deliver ack.

The method is supposed to be called by the SDK instead of you.

Parameters
isDeliverAcked- true: The message is delivered to the other party.
  • false: The message has not been delivered to the other party.

◆ setDelivered()

void io.agora.chat.ChatMessage.setDelivered ( boolean  isDelivered)

Sets whether the message is successfully delivered.

The method is supposed to be called by the SDK instead of you.

Parameters
isDeliveredWhether the message is successfully delivered: -true: Yes. -false: No.

◆ setDirection()

void io.agora.chat.ChatMessage.setDirection ( Direct  dir)

Sets the message direction.

Parameters
dirThe message direction. See Direct.

◆ setFrom()

void io.agora.chat.ChatMessage.setFrom ( String  from)

Sets the user ID of the message sender.

Parameters
fromThe user ID of the message sender.

◆ setGroupAckCount()

void io.agora.chat.ChatMessage.setGroupAckCount ( int  count)

Sets the number of members that have read the group message.

Parameters
countThe number of members that have read the group message.

◆ setIsChatThreadMessage()

void io.agora.chat.ChatMessage.setIsChatThreadMessage ( boolean  isChatThreadMessage)

Sets whether the message is a threaded message.

Parameters
isChatThreadMessage- true means set to a threaded message.
  • false means not set as a threaded message.

◆ setIsNeedGroupAck()

void io.agora.chat.ChatMessage.setIsNeedGroupAck ( boolean  need)

Sets whether read receipts are required for group messages.

Parameters
needWhether read receipts are required for group messages.
  • true: Yes;
  • false: No.

◆ setListened()

void io.agora.chat.ChatMessage.setListened ( boolean  isListened)

Sets whether the voice message is listened.

The method is supposed to be called by the SDK instead of you.

Parameters
isListenedWhether the voice message is listened:
  • true: Yes.
  • false: No.

◆ setLocalTime()

void io.agora.chat.ChatMessage.setLocalTime ( long  serverTime)

Sets the local timestamp of the message.

This method sets the timestamp when the message is created locally.

Parameters
serverTimeThe local timestamp of the message.

◆ setMessageStatusCallback()

synchronized void io.agora.chat.ChatMessage.setMessageStatusCallback ( CallBack  callback)

Sets the message status change callback.

After the callback is triggered, the UI will be refreshed.

Parameters
callbackThe callback triggered when the message status changes.

◆ setMsgId()

void io.agora.chat.ChatMessage.setMsgId ( String  msgId)

Sets the local message ID.

Parameters
msgIdSets the local message ID.

◆ setMsgTime()

void io.agora.chat.ChatMessage.setMsgTime ( long  msgTime)

Sets the Unix timestamp when the server receives the message.

Parameters
msgTimeThe Unix timestamp when the server receives the message.

◆ setPriority()

void io.agora.chat.ChatMessage.setPriority ( ChatRoomMessagePriority  priority)

Set message priority chatroom message priority

Parameters
priority

◆ setProgress()

void io.agora.chat.ChatMessage.setProgress ( int  progress)

Sets the progress for uploading or downloading a message attachment.

Usually, you do not need to set the progress value. See ChatMessage#progress().

Parameters
progressThe progress for uploading or downloading the message attachment. The value range is [0,100].

◆ setStatus()

void io.agora.chat.ChatMessage.setStatus ( Status  status)

Sets the message sending or reception status.

Parameters
statusThe message sending or reception status.

◆ setTo()

void io.agora.chat.ChatMessage.setTo ( String  to)

Sets the user ID of the message recipient.

Parameters
toThe user ID of the message recipient.

◆ setUnread()

void io.agora.chat.ChatMessage.setUnread ( boolean  unread)

Sets whether the message is unread.

We recommend you to use Conversation#markAllMessagesAsRead() to mark all messages in a conversation as read.

Parameters
unreadWhether the message is unread.
  • true: Yes.
  • false: No.

◆ status()

Status io.agora.chat.ChatMessage.status ( )

Gets the message sending or reception status.

Returns
The message sending or reception status.

Member Data Documentation

◆ CREATOR

final Parcelable.Creator<ChatMessage> io.agora.chat.ChatMessage.CREATOR
static
Initial value:
= new Parcelable.Creator<ChatMessage>() {
public ChatMessage createFromParcel(Parcel in) {
ChatMessage msg = null;
try {
msg = new ChatMessage(in);
} catch (ChatException e) {
e.printStackTrace();
}
return msg;
}
public ChatMessage[] newArray(int size) {
return new ChatMessage[size];
}
}

The documentation for this class was generated from the following file: