agora_chat_SDK 1.0.6
agora java chat SDK
|
Classes | |
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< MessageReaction > | getMessageReaction () |
boolean | isOnlineState () |
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< ChatMessage > | CREATOR |
The message instance, which represents a sent/received message.
For example: Constructs a text message to send:
Constructs a new received text message:
void io.agora.chat.ChatMessage.addBody | ( | MessageBody | body | ) |
Adds a message body. We recommend you use ChatMessage#setBody(io.agora.chat.MessageBody). Only support to add one now.
body | The message body. |
String io.agora.chat.ChatMessage.conversationId | ( | ) |
Gets the conversation ID.
|
static |
Creates a message to send a regular file.
filePath | The file path. |
username | The message recipient (user or group) ID. |
|
static |
Creates a message instance to send a regular file.
filePath | The file path. |
username | The message recipient (user or group) ID. |
|
static |
Creates an image message for sending.
filePath | The image path. |
sendOriginalImage | Whether to send the original image.
|
username | The message recipient (user or group) ID. |
|
static |
Creates an image message for sending.
imgUri | The URI of the image. |
sendOriginalImage | Whether to send the original.
|
username | The recipient(user or group) ID. |
|
static |
Creates a location message for sending.
latitude | The latitude. |
longitude | The longitude. |
locationAddress | The location details. |
buildingName | The name of the building. |
username | The message recipient (user or group) ID. |
|
static |
Creates a location message for sending.
latitude | The latitude. |
longitude | The longitude. |
locationAddress | The location details. |
username | The message recipient (user or group) ID. |
|
static |
Creates a new received message instance.
type | The message type. |
|
static |
Creates a message instance for sending.
type | The message type. |
|
static |
Creates a text message for sending.
content | The text content. |
username | The ID of the message recipient(user or group). |
|
static |
Creates a text message for sending.
content | The text content. |
username | The ID of the message recipient(user or group). |
|
static |
Creates a video message instance for sending.
videofilePath | The path of the video file. |
imageThumbPath | The path of the thumbnail. |
timeLength | The video duration in seconds. |
username | The message recipient(user or group) ID. |
|
static |
Creates a video message instance for sending.
videofilePath | The path of the video file. |
imageThumbPath | The path of the thumbnail of the first frame of video. |
timeLength | The video duration in seconds. |
username | The message recipient(user or group) ID. |
|
static |
Creates a video message instance for sending.
videofilePath | The path of the video file. |
imageThumbPath | The path of the thumbnail of the first frame of video. |
timeLength | The video duration in seconds. |
username | The message recipient(user or group) ID. |
|
static |
Creates a voice message for sending.
filePath | The path of the voice file. |
timeLength | The voice duration in seconds. |
username | The message recipient (user or group) ID. |
|
static |
Creates a voice message for sending.
filePath | The URI of the voice file. |
timeLength | The voice duration in seconds. |
username | The message recipient (user or group) ID. |
Direct io.agora.chat.ChatMessage.direct | ( | ) |
The message direction.
Map< String, Object > io.agora.chat.ChatMessage.ext | ( | ) |
Gets all of the message‘s extension. The return type is Map<String, Object>.
MessageBody io.agora.chat.ChatMessage.getBody | ( | ) |
Gets the message body.
boolean io.agora.chat.ChatMessage.getBooleanAttribute | ( | String | attribute | ) | throws ChatException |
Gets a message extension attribute of the boolean type.
attribute | The attribute name. |
ChatException | When exceptions occur, you can troubleshoot issues by referring to the error code and the error description. |
boolean io.agora.chat.ChatMessage.getBooleanAttribute | ( | String | attribute, |
boolean | defaultValue | ||
) |
Gets a message extension attribute of the boolean type.
attribute | The attribute name. |
defaultValue | The default value you want. |
ChatType io.agora.chat.ChatMessage.getChatType | ( | ) |
Gets the chat type.
double io.agora.chat.ChatMessage.getDoubleAttribute | ( | String | attribute | ) | throws ChatException |
Gets a message extension attribute of the double type.
attribute | The attribute name. |
ChatException | When exceptions occur, you can troubleshoot issues by referring to the error code and the error description. |
double io.agora.chat.ChatMessage.getDoubleAttribute | ( | String | attribute, |
double | defaultValue | ||
) |
Gets a message extension attribute of the double type.
attribute | The attribute name. |
defaultValue | The default value you want. |
float io.agora.chat.ChatMessage.getFloatAttribute | ( | String | attribute | ) | throws ChatException |
Gets a message extension attribute of the float type.
attribute | The attribute name. |
ChatException | When exceptions occur, you can troubleshoot issues by referring to the error code and the error description. |
float io.agora.chat.ChatMessage.getFloatAttribute | ( | String | attribute, |
float | defaultValue | ||
) |
Gets a message extension attribute of the float type.
attribute | The attribute name. |
defaultValue | The default value you want. |
String io.agora.chat.ChatMessage.getFrom | ( | ) |
Gets the user ID of the message sender.
int io.agora.chat.ChatMessage.getIntAttribute | ( | String | attribute | ) | throws ChatException |
Gets an extension attribute of the integer type.
attribute | The attribute name. |
ChatException | When exceptions occur, you can troubleshoot issues by referring to the error code and the error description. |
int io.agora.chat.ChatMessage.getIntAttribute | ( | String | attribute, |
int | defaultValue | ||
) |
Gets a message extension attribute of the integer type.
attribute | The attribute name. |
defaultValue | The default value you want. |
JSONArray io.agora.chat.ChatMessage.getJSONArrayAttribute | ( | String | attribute | ) | throws ChatException |
Gets a JSONArray type attribute.
attribute | The attribute name. |
ChatException | When exceptions occur, you can troubleshoot issues by referring to the error code and the error description. |
JSONObject io.agora.chat.ChatMessage.getJSONObjectAttribute | ( | String | attribute | ) | throws ChatException |
Gets the JSONObject type attribute.
attribute | The attribute name. |
ChatException | When exceptions occur, you can troubleshoot issues by referring to the error code and the error description. |
long io.agora.chat.ChatMessage.getLongAttribute | ( | String | attribute | ) | throws ChatException |
Gets a message extension attribute of the long integer type.
attribute | The attribute name. |
ChatException | When exceptions occur, you can troubleshoot issues by referring to the error code and the error description. |
long io.agora.chat.ChatMessage.getLongAttribute | ( | String | attribute, |
long | defaultValue | ||
) |
Gets a message extension attribute of the long integer type.
attribute | The attribute name. |
defaultValue | The default value you want. |
List< MessageReaction > io.agora.chat.ChatMessage.getMessageReaction | ( | ) |
Gets the list of Reactions.
String io.agora.chat.ChatMessage.getMsgId | ( | ) |
Gets the message ID.
long io.agora.chat.ChatMessage.getMsgTime | ( | ) |
Gets the Unix timestamp (server time) of the message.
String io.agora.chat.ChatMessage.getRecaller | ( | ) |
Gets the ID of the user that recalls the message.
String io.agora.chat.ChatMessage.getStringAttribute | ( | String | attribute | ) | throws ChatException |
Gets a string type extension attribute
attribute | The attribute name. |
ChatException | The error code and the description of the cause of exception. |
String io.agora.chat.ChatMessage.getStringAttribute | ( | String | attribute, |
String | defaultValue | ||
) |
Gets a string type extension attribute
attribute | The attribute name. |
defaultValue | The default value you want. |
String io.agora.chat.ChatMessage.getTo | ( | ) |
Gets the user ID of the message recipient.
Type io.agora.chat.ChatMessage.getType | ( | ) |
\chinese 获取消息类型。
Gets the chat message type.
String io.agora.chat.ChatMessage.getUserName | ( | ) |
Gets the other party's ID.
int io.agora.chat.ChatMessage.groupAckCount | ( | ) |
Gets the number of members that have read the group message.
boolean io.agora.chat.ChatMessage.isAcked | ( | ) |
Gets whether the other party has read the message.
true
: the other party has read the message. boolean io.agora.chat.ChatMessage.isDelivered | ( | ) |
Gets the delivery receipt, which is to check whether the other party has received the message.
true
:the message has been delivered to the other party. boolean io.agora.chat.ChatMessage.isListened | ( | ) |
Gets whether the voice message has been listened.
true
: The voice message has been listened.false
: The voice message has NOT been listened. boolean io.agora.chat.ChatMessage.isNeedGroupAck | ( | ) |
Sets whether read receipts are required for group messages.
true
: Read receipts are required;false
: Read receipts are NOT required. boolean io.agora.chat.ChatMessage.isOnlineState | ( | ) |
Is it an online message.
boolean io.agora.chat.ChatMessage.isUnread | ( | ) |
Checks whether the message is unread.
true
: The message is unread. -false
: The message is read. long io.agora.chat.ChatMessage.localTime | ( | ) |
Gets the local timestamp of the message.
int io.agora.chat.ChatMessage.progress | ( | ) |
The upload or download progress value of the message attachment in the message body. The value ranges between 0-100. For the thumbnail of the message attachment, it doesn't has progress information.
void io.agora.chat.ChatMessage.setAcked | ( | boolean | isAcked | ) |
Sets whether the message has been read by the other party. The method is supposed to be called by the SDK instead of you.
isAcked | - true :the message has been read by the other party. |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
boolean | value | ||
) |
Sets a message's extension attribute of the boolean type.
attribute | The attribute name. |
value | The attribute value. |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
double | value | ||
) |
Sets a message extension attribute of the double type.
attribute | The attribute name. |
value | The attribute value. |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
float | value | ||
) |
Sets a message extension attribute of the float type.
attribute | The attribute name. |
value | The attribute value. |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
int | value | ||
) |
Sets a message extension attribute of the integer type.
attribute | The attribute name. |
value | The attribute value. |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
JSONArray | value | ||
) |
Sets a message extension attribute of the JSONArray type.
attribute | The attribute name. |
value | The attribute value. |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
JSONObject | value | ||
) |
Sets a message extension attribute of the JsonObject type.
attribute | The attribute name. |
value | The attribute value. |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
long | value | ||
) |
Sets a message extension attribute of the long type.
attribute | The attribute name. |
value | The attribute value. |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
String | value | ||
) |
Sets a string type extension attributes of the message.
attribute | The attribute name. |
value | The attribute value. |
void io.agora.chat.ChatMessage.setBody | ( | MessageBody | body | ) |
(Recommended)Sets the message body.
body | The message body. |
void io.agora.chat.ChatMessage.setChatType | ( | ChatType | chatType | ) |
Sets the chat type. The default value is one-to-one chat(single chat) ChatType#Chat.
chatType | The chat type, see ChatType. |
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.
isDeliverAcked | - true : The message is delivered to the other party.
|
void io.agora.chat.ChatMessage.setDelivered | ( | boolean | isDelivered | ) |
Sets whether the message has been delivered to the other party. The method is supposed to be called by the SDK instead of you.
isDelivered | - true : The message has been delivered to the other party. |
void io.agora.chat.ChatMessage.setDirection | ( | Direct | dir | ) |
Sets the message direction.
dir | The message direction, see Direct. |
void io.agora.chat.ChatMessage.setFrom | ( | String | from | ) |
Sets the user ID of the message sender.
from | The user ID of the message sender. |
void io.agora.chat.ChatMessage.setGroupAckCount | ( | int | count | ) |
Sets the number of members that have read the group message.
count | The number of members that have read the group message. |
void io.agora.chat.ChatMessage.setIsNeedGroupAck | ( | boolean | need | ) |
Sets whether read receipts are required for group messages.
need | - true : Read receipts are required;
|
void io.agora.chat.ChatMessage.setListened | ( | boolean | isListened | ) |
Sets whether the voice message has been listened.
The method is supposed to be called by the SDK instead of you.
isListened | - true : Sets the voice message as listened.
|
void io.agora.chat.ChatMessage.setLocalTime | ( | long | serverTime | ) |
Sets the local timestamp of the message.
serverTime | The local timestamp of the message. |
synchronized void io.agora.chat.ChatMessage.setMessageStatusCallback | ( | CallBack | callback | ) |
Sets the message status change callback. Your app should set emaObject callback to get the message status and then refresh the UI accordingly.
callback | The callback when the message status changed. |
void io.agora.chat.ChatMessage.setMsgId | ( | String | msgId | ) |
Sets the local message ID.
msgId | Sets the local message ID. |
void io.agora.chat.ChatMessage.setMsgTime | ( | long | msgTime | ) |
Sets the Unix timestamp (server time) of the message.
msgTime | The Unix timestamp (server time) of the message. |
void io.agora.chat.ChatMessage.setProgress | ( | int | progress | ) |
Sets the upload or download progress value of the message attachment. The value ranges between 0-100. Usually you don't need to set progress value.
progress |
void io.agora.chat.ChatMessage.setStatus | ( | Status | status | ) |
Sets the message sending or reception status.
status | The message sending or reception status. |
void io.agora.chat.ChatMessage.setTo | ( | String | to | ) |
Sets the user ID of the message recipient.
to | The user ID of the message recipient. |
void io.agora.chat.ChatMessage.setUnread | ( | boolean | unread | ) |
Sets the message as unread.
true
: Sets the message as unread.false
: Sets the message as read.Reference: We recommend you to use Conversation#markAllMessagesAsRead() in a conversation.
unread |
|
Status io.agora.chat.ChatMessage.status | ( | ) |
Gets the message sending/reception status.
|
static |