|
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 | setBody (MessageBody body) |
|
void | addBody (MessageBody body) |
|
String | getFrom () |
|
void | setFrom (String from) |
|
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, 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) |
|
int | getIntAttribute (String attribute) throws ChatException |
|
long | getLongAttribute (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 () |
|
|
static ChatMessage | createSendMessage (Type type) |
|
static ChatMessage | createReceiveMessage (Type type) |
|
static ChatMessage | createTxtSendMessage (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 username) |
|
static ChatMessage | createFileSendMessage (String filePath, String username) |
|
static ChatMessage | createFileSendMessage (Uri filePath, String username) |
|
Message object, represent a sent/received message
Construct a new send text message
ChatMessage msg = ChatMessage.createSendMessage(ChatMessage.Type.TXT);
msg.setTo("user1");
TextMessageBody body = new TextMessageBody("hello from hyphenate sdk");
msg.addBody(body);
Construct a new receive text message
ChatMessage msg = ChatMessage.createSendMessage(ChatMessage.Type.IMAGE);
msg.setTo("user1");
ImageMessageBody body = new ImageMessageBody(imageFileUrl);
msg.addBody(body);
void io.agora.chat.ChatMessage.addBody |
( |
MessageBody |
body | ) |
|
Add a message body Only support add one now
- Parameters
-
String io.agora.chat.ChatMessage.conversationId |
( |
| ) |
|
static ChatMessage io.agora.chat.ChatMessage.createFileSendMessage |
( |
String |
filePath, |
|
|
String |
username |
|
) |
| |
|
static |
Create a normal file send message
- Parameters
-
filePath | The path of the file |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createFileSendMessage |
( |
Uri |
filePath, |
|
|
String |
username |
|
) |
| |
|
static |
Create a normal file send message
- Parameters
-
filePath | The path of the file |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createImageSendMessage |
( |
String |
filePath, |
|
|
boolean |
sendOriginalImage, |
|
|
String |
username |
|
) |
| |
|
static |
Create a image send message
- Parameters
-
filePath | The path of the image |
sendOriginalImage | Whether to send the original(if image greater than 100k sdk will be compressed) |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createImageSendMessage |
( |
Uri |
imgUri, |
|
|
boolean |
sendOriginalImage, |
|
|
String |
username |
|
) |
| |
|
static |
Create a image send message
- Parameters
-
imgUri | The uri of the image |
sendOriginalImage | Whether to send the original(if image greater than 100k sdk will be compressed) |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createLocationSendMessage |
( |
double |
latitude, |
|
|
double |
longitude, |
|
|
String |
locationAddress, |
|
|
String |
username |
|
) |
| |
|
static |
Create a location send message
- Parameters
-
latitude | The latitude |
longitude | The longitude |
locationAddress | Location details |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createReceiveMessage |
( |
Type |
type | ) |
|
|
static |
Create a new receive message
- Parameters
-
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createSendMessage |
( |
Type |
type | ) |
|
|
static |
Create a new send message
- Parameters
-
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createTxtSendMessage |
( |
String |
content, |
|
|
String |
username |
|
) |
| |
|
static |
Create a text send message
- Parameters
-
content | Text content |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createVideoSendMessage |
( |
String |
videofilePath, |
|
|
String |
imageThumbPath, |
|
|
int |
timeLength, |
|
|
String |
username |
|
) |
| |
|
static |
Create a video send message
- Parameters
-
videofilePath | The path of the video file |
imageThumbPath | The path of the thumbnail |
timeLength | The length of the video time, unit s |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createVideoSendMessage |
( |
Uri |
videofilePath, |
|
|
String |
imageThumbPath, |
|
|
int |
timeLength, |
|
|
String |
username |
|
) |
| |
|
static |
Create a video send message
- Parameters
-
videofilePath | The path of the video file |
imageThumbPath | The path of the thumbnail |
timeLength | The length of the video time, unit s |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createVideoSendMessage |
( |
Uri |
videofilePath, |
|
|
Uri |
imageThumbPath, |
|
|
int |
timeLength, |
|
|
String |
username |
|
) |
| |
|
static |
Create a video send message
- Parameters
-
videofilePath | The path of the video file |
imageThumbPath | The path of the thumbnail |
timeLength | The length of the video time, unit s |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createVoiceSendMessage |
( |
String |
filePath, |
|
|
int |
timeLength, |
|
|
String |
username |
|
) |
| |
|
static |
Create a voice send message
- Parameters
-
filePath | The path of the voice file |
timeLength | The time length of the voice(unit s) |
username | The recipient(user or group) id |
- Returns
- The message instance
static ChatMessage io.agora.chat.ChatMessage.createVoiceSendMessage |
( |
Uri |
filePath, |
|
|
int |
timeLength, |
|
|
String |
username |
|
) |
| |
|
static |
Create a voice send message
- Parameters
-
filePath | The uri of the voice file |
timeLength | The time length of the voice(unit s) |
username | The recipient(user or group) id |
- Returns
- The message instance
Direct io.agora.chat.ChatMessage.direct |
( |
| ) |
|
The message direction
- Returns
- See Direct
Map<String, Object> io.agora.chat.ChatMessage.ext |
( |
| ) |
|
Get message extension, return type is Map<String, Object>
- Returns
- Return message extension, return type is Map<String, Object> 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
Get message body
- Returns
- Message body
boolean io.agora.chat.ChatMessage.getBooleanAttribute |
( |
String |
attribute | ) |
throws ChatException |
Get a boolean type extra attribute
- Parameters
-
- Returns
- Attribute value
- Exceptions
-
boolean io.agora.chat.ChatMessage.getBooleanAttribute |
( |
String |
attribute, |
|
|
boolean |
defaultValue |
|
) |
| |
Get a boolean type extra attribute
- Parameters
-
attribute | Attribute key |
defaultValue | the default value you want |
- Returns
- Attribute value
ChatType io.agora.chat.ChatMessage.getChatType |
( |
| ) |
|
String io.agora.chat.ChatMessage.getFrom |
( |
| ) |
|
Get the sender id
- Returns
- user id
int io.agora.chat.ChatMessage.getIntAttribute |
( |
String |
attribute, |
|
|
int |
defaultValue |
|
) |
| |
Get a int type extra attribute
- Parameters
-
attribute | Attribute key |
defaultValue | The default value you want |
- Returns
- Attribute value
int io.agora.chat.ChatMessage.getIntAttribute |
( |
String |
attribute | ) |
throws ChatException |
Get a int type extra attribute
- Parameters
-
- Returns
- Attribute value
- Exceptions
-
JSONArray io.agora.chat.ChatMessage.getJSONArrayAttribute |
( |
String |
attribute | ) |
throws ChatException |
Get a JSONArray type attribute
- Parameters
-
- Returns
- Attribute value
- Exceptions
-
JSONObject io.agora.chat.ChatMessage.getJSONObjectAttribute |
( |
String |
attribute | ) |
throws ChatException |
Get a JSONObject type attribute
- Parameters
-
- Returns
- Attribute value
- Exceptions
-
long io.agora.chat.ChatMessage.getLongAttribute |
( |
String |
attribute, |
|
|
long |
defaultValue |
|
) |
| |
Get a long type extra attribute
- Parameters
-
attribute | Attribute key |
defaultValue | The default value you want |
- Returns
- Attribute value
long io.agora.chat.ChatMessage.getLongAttribute |
( |
String |
attribute | ) |
throws ChatException |
Get long type extra attribute
- Parameters
-
- Returns
- Attribute value
- Exceptions
-
String io.agora.chat.ChatMessage.getMsgId |
( |
| ) |
|
Get message id
- Returns
- Message id
long io.agora.chat.ChatMessage.getMsgTime |
( |
| ) |
|
Get message timestamp(server time)
- Returns
- Message timestamp(server time)
String io.agora.chat.ChatMessage.getStringAttribute |
( |
String |
attribute | ) |
throws ChatException |
Get a string type extra attribute
- Parameters
-
- Returns
- Attribute value
- Exceptions
-
String io.agora.chat.ChatMessage.getStringAttribute |
( |
String |
attribute, |
|
|
String |
defaultValue |
|
) |
| |
Get a string type extra attribute
- Parameters
-
attribute | Attribute key |
defaultValue | The default value you want |
- Returns
- Attribute value
String io.agora.chat.ChatMessage.getTo |
( |
| ) |
|
Get receiver name
- Returns
- Receiver name
Type io.agora.chat.ChatMessage.getType |
( |
| ) |
|
获取消息类型
- Returns
- 消息类型
Get message chat type
- Returns
- Message chat type
String io.agora.chat.ChatMessage.getUserName |
( |
| ) |
|
Get the peer's id
- Returns
- Peer's id
int io.agora.chat.ChatMessage.groupAckCount |
( |
| ) |
|
Read ack number of group message
- Returns
- Read ack number of group message
boolean io.agora.chat.ChatMessage.isAcked |
( |
| ) |
|
whether to read ack by the other
- Returns
- whether to read
boolean io.agora.chat.ChatMessage.isDelivered |
( |
| ) |
|
Delivery Ack, check if the peer has received the message
- Returns
- Whether the peer has received the message
boolean io.agora.chat.ChatMessage.isListened |
( |
| ) |
|
Get whether the message has been listened
- Returns
boolean io.agora.chat.ChatMessage.isNeedGroupAck |
( |
| ) |
|
Message if need group read ack
- Returns
- True: need group read ack; False: not need group read ack
boolean io.agora.chat.ChatMessage.isUnread |
( |
| ) |
|
Check if the message has been read
- Returns
- Whether the message has been read
long io.agora.chat.ChatMessage.localTime |
( |
| ) |
|
Get local timestamp
- Returns
- Local timestamp
int io.agora.chat.ChatMessage.progress |
( |
| ) |
|
Indicate message attachment upload or download progress, value ranges between 0-100 For message attachment's thumbnail, it doesn't has progress information
- Returns
- progress value
void io.agora.chat.ChatMessage.setAcked |
( |
boolean |
isAcked | ) |
|
Sets whether the other has been read Not supposed to be called by app
- Parameters
-
void io.agora.chat.ChatMessage.setAttribute |
( |
String |
attribute, |
|
|
boolean |
value |
|
) |
| |
Set a boolean type extra attributes of the message
- Parameters
-
attribute | Attribute key |
value | Attribute value |
void io.agora.chat.ChatMessage.setAttribute |
( |
String |
attribute, |
|
|
int |
value |
|
) |
| |
Set a int type extra attributes of the message
- Parameters
-
attribute | Attribute key |
value | Attribute value |
void io.agora.chat.ChatMessage.setAttribute |
( |
String |
attribute, |
|
|
long |
value |
|
) |
| |
Set a long type extra attributes of the message
- Parameters
-
attribute | Attribute key |
value | Attribute value |
void io.agora.chat.ChatMessage.setAttribute |
( |
String |
attribute, |
|
|
JSONObject |
value |
|
) |
| |
Set a JSONObject type extra attributes of the message
- Parameters
-
attribute | Attribute key |
value | Attribute value |
void io.agora.chat.ChatMessage.setAttribute |
( |
String |
attribute, |
|
|
JSONArray |
value |
|
) |
| |
Set a JSONArray type extra attributes of the message
- Parameters
-
attribute | Attribute key |
value | Attribute value |
void io.agora.chat.ChatMessage.setAttribute |
( |
String |
attribute, |
|
|
String |
value |
|
) |
| |
Set a string type extra attributes of the message
- Parameters
-
attribute | Attribute key |
value | Attribute value |
void io.agora.chat.ChatMessage.setBody |
( |
MessageBody |
body | ) |
|
set message body
- Parameters
-
void io.agora.chat.ChatMessage.setChatType |
( |
ChatType |
chatType | ) |
|
Set chat type The default is single chat ChatType#Chat
- Parameters
-
void io.agora.chat.ChatMessage.setDeliverAcked |
( |
boolean |
isDeliverAcked | ) |
|
Set message deliver ack Not supposed to be called by app
- Parameters
-
void io.agora.chat.ChatMessage.setDelivered |
( |
boolean |
isDelivered | ) |
|
Sets whether the message has been delivered Not supposed to be called by app
- Parameters
-
void io.agora.chat.ChatMessage.setDirection |
( |
Direct |
dir | ) |
|
Set message direction
- Parameters
-
dir | Message direction, see Direct |
void io.agora.chat.ChatMessage.setFrom |
( |
String |
from | ) |
|
Set message sender id
- Parameters
-
void io.agora.chat.ChatMessage.setGroupAckCount |
( |
int |
count | ) |
|
Set read ack number of group message
- Parameters
-
void io.agora.chat.ChatMessage.setIsNeedGroupAck |
( |
boolean |
need | ) |
|
Set message if need group read ack
- Parameters
-
void io.agora.chat.ChatMessage.setListened |
( |
boolean |
isListened | ) |
|
Sets whether the other has been listened
- Parameters
-
void io.agora.chat.ChatMessage.setLocalTime |
( |
long |
serverTime | ) |
|
Set message local time
- Parameters
-
serverTime | Message local time |
synchronized void io.agora.chat.ChatMessage.setMessageStatusCallback |
( |
CallBack |
callback | ) |
|
Set message status callback Your app should set emaObject callback to get message status and then refresh the ui accordingly
- Parameters
-
void io.agora.chat.ChatMessage.setMsgId |
( |
String |
msgId | ) |
|
Set local message id
- Parameters
-
void io.agora.chat.ChatMessage.setMsgTime |
( |
long |
msgTime | ) |
|
Set message timestamp (server time)
- Parameters
-
msgTime | Message timestamp (server time) |
void io.agora.chat.ChatMessage.setProgress |
( |
int |
progress | ) |
|
Set message attachment upload or download progress, value ranges between 0-100 For app developing, it doesn't need to set progress
- Parameters
-
void io.agora.chat.ChatMessage.setStatus |
( |
Status |
status | ) |
|
Set the status of the message
- Parameters
-
void io.agora.chat.ChatMessage.setTo |
( |
String |
to | ) |
|
Sets the receiver ID of the message
- Parameters
-
Status io.agora.chat.ChatMessage.status |
( |
| ) |
|
Get the send/receive status of message
- Returns
- Send/receive status of message
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:
- hyphenatechatsdk/src/io/agora/chat/ChatMessage.java