agora_chat_SDK 1.0.6
agora java chat SDK
|
类 | |
enum | ChatType |
enum | Direct |
class | EMCallbackHolder |
enum | Status |
enum | Type |
Public 成员函数 | |
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 () |
静态 Public 成员函数 | |
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) |
静态 Public 属性 | |
static final Parcelable.Creator< ChatMessage > | CREATOR |
消息对象,代表一条发送或接收到的消息。
例如: 构造一条文本发送消息:
构造一条图片消息:
void io.agora.chat.ChatMessage.addBody | ( | MessageBody | body | ) |
添加消息体。与(建议方法)设置消息体 ChatMessage#setBody(io.agora.chat.MessageBody) 的方法效果一样。 只支持一条消息添加一个消息体。
body | 消息体。 |
String io.agora.chat.ChatMessage.conversationId | ( | ) |
获取会话 ID。
|
static |
创建一个普通文件发送消息。
filePath | 文件路径。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个普通文件发送消息。
filePath | 文件路径。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个图片发送消息。
filePath | 图片路径。 |
sendOriginalImage | 是否发送原图。
|
username | 消息接收人或群 ID。 |
|
static |
创建一个图片发送消息。
imgUri | 图片 URI。 |
sendOriginalImage | 是否发送原图。
|
username | 消息接收人或群 ID。 |
|
static |
创建一个位置发送消息。
latitude | 纬度。 |
longitude | 经度。 |
locationAddress | 位置详情。 |
buildingName | 建筑物名称。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个位置发送消息。
latitude | 纬度。 |
longitude | 经度。 |
locationAddress | 位置详情。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个接收消息。
type | 消息类型。 |
|
static |
创建一个发送消息。
type | 消息类型。 |
|
static |
创建一个文本发送消息。
content | 文本内容。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个文本发送消息。
content | 文本内容。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个视频发送消息。
videofilePath | 视频文件路径。 |
imageThumbPath | 视频第一帧图缩略图。 |
timeLength | 视频时间长度(单位秒)。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个视频发送消息。
videofilePath | 视频文件路径。 |
imageThumbPath | 视频第一帧图缩略图。 |
timeLength | 视频时间长度(单位秒)。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个视频发送消息。
videofilePath | 视频文件路径。 |
imageThumbPath | 视频第一帧图缩略图。 |
timeLength | 视频时间长度(单位秒)。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个语音发送消息。
filePath | 语音文件路径。 |
timeLength | 语音时间长度(单位秒)。 |
username | 消息接收人或群 ID。 |
|
static |
创建一个语音发送消息。
filePath | 语音文件 URI。 |
timeLength | 语音时间长度(单位秒)。 |
username | 消息接收人或群 ID。 |
Map< String, Object > io.agora.chat.ChatMessage.ext | ( | ) |
获取消息包含的全部扩展字段,并以 Map<String, Object> 形式返回。
MessageBody io.agora.chat.ChatMessage.getBody | ( | ) |
获取消息体。
boolean io.agora.chat.ChatMessage.getBooleanAttribute | ( | String | attribute | ) | throws ChatException |
获取 boolean 类型的消息扩展属性。
attribute | 属性名。 |
ChatException | 如果有异常会在这里抛出,包含错误码和异常原因。 |
boolean io.agora.chat.ChatMessage.getBooleanAttribute | ( | String | attribute, |
boolean | defaultValue | ||
) |
获取 boolean 类型扩展属性。
attribute | 属性名。 |
defaultValue | 默认值。 |
ChatThread io.agora.chat.ChatMessage.getChatThread | ( | ) |
获取子区概览信息,仅当消息创建子区后携带。
Get Chat Thread overview information, which is carried only after Chat Thread is created in the message.
ChatType io.agora.chat.ChatMessage.getChatType | ( | ) |
获取聊天类型。
double io.agora.chat.ChatMessage.getDoubleAttribute | ( | String | attribute | ) | throws ChatException |
获取 double 类型扩展属性
attribute | 属性名。 |
ChatException | 如果有异常会在这里抛出,包含错误码和异常原因。 |
double io.agora.chat.ChatMessage.getDoubleAttribute | ( | String | attribute, |
double | defaultValue | ||
) |
获取消息的 double 类型扩展属性。
attribute | 属性名。 |
defaultValue | 默认值。 |
float io.agora.chat.ChatMessage.getFloatAttribute | ( | String | attribute | ) | throws ChatException |
获取 float 类型扩展属性
attribute | 属性名。 |
ChatException | 如果有异常会在这里抛出,包含错误码和异常原因。 |
float io.agora.chat.ChatMessage.getFloatAttribute | ( | String | attribute, |
float | defaultValue | ||
) |
获取消息的 float 类型扩展属性。
attribute | 属性名。 |
defaultValue | 默认值。 |
String io.agora.chat.ChatMessage.getFrom | ( | ) |
获取消息发送者的用户名。
int io.agora.chat.ChatMessage.getIntAttribute | ( | String | attribute | ) | throws ChatException |
获取消息的 int 类型扩展属性。
attribute | 属性名。 |
ChatException | 如果有异常会在这里抛出,包含错误码和异常原因。 |
int io.agora.chat.ChatMessage.getIntAttribute | ( | String | attribute, |
int | defaultValue | ||
) |
获取消息的 int 类型扩展属性。
attribute | 属性名。 |
defaultValue | 默认值。 |
JSONArray io.agora.chat.ChatMessage.getJSONArrayAttribute | ( | String | attribute | ) | throws ChatException |
获取 JSONArray 类型扩展属性。
attribute | 属性名。 |
ChatException | 如果有异常会在这里抛出,包含错误码和异常原因。 |
JSONObject io.agora.chat.ChatMessage.getJSONObjectAttribute | ( | String | attribute | ) | throws ChatException |
获取 JSONObject 类型扩展属性
attribute | 属性名。 |
ChatException | 如果有异常会在这里抛出,包含错误码和异常原因。 |
long io.agora.chat.ChatMessage.getLongAttribute | ( | String | attribute | ) | throws ChatException |
获取 long 类型扩展属性
attribute | 属性名。 |
ChatException | 如果有异常会在这里抛出,包含错误码和异常原因。 |
long io.agora.chat.ChatMessage.getLongAttribute | ( | String | attribute, |
long | defaultValue | ||
) |
获取消息的 long 类型扩展属性。
attribute | 属性名。 |
defaultValue | 默认值。 |
List< MessageReaction > io.agora.chat.ChatMessage.getMessageReaction | ( | ) |
获取 Reaction 列表。
String io.agora.chat.ChatMessage.getMsgId | ( | ) |
获取消息的 ID。
long io.agora.chat.ChatMessage.getMsgTime | ( | ) |
获取消息的时间戳(服务器时间)。
String io.agora.chat.ChatMessage.getRecaller | ( | ) |
获取消息撤回者的用户 ID。
String io.agora.chat.ChatMessage.getStringAttribute | ( | String | attribute | ) | throws ChatException |
获取 String 类型扩展属性。
attribute | 属性名。 |
ChatException | 如果有异常会在这里抛出,包含错误码和异常原因。 |
String io.agora.chat.ChatMessage.getStringAttribute | ( | String | attribute, |
String | defaultValue | ||
) |
获取 String 类型扩展属性。
attribute | 属性名。 |
defaultValue | 默认值。 |
String io.agora.chat.ChatMessage.getTo | ( | ) |
获取消息接收者的用户名。
Type io.agora.chat.ChatMessage.getType | ( | ) |
\chinese 获取消息类型。
String io.agora.chat.ChatMessage.getUserName | ( | ) |
获取通话对象的用户 ID。
int io.agora.chat.ChatMessage.groupAckCount | ( | ) |
群消息已读人数。
boolean io.agora.chat.ChatMessage.isAcked | ( | ) |
获取对方是否已读。
true
表示已读。 boolean io.agora.chat.ChatMessage.isChatThreadMessage | ( | ) |
获取消息是否是 Thread 消息
boolean io.agora.chat.ChatMessage.isDelivered | ( | ) |
获取消息是否已到达对方。
true
:已送达。 boolean io.agora.chat.ChatMessage.isListened | ( | ) |
获取语音是否已听。
true
:消息已听。false
:消息未听。 boolean io.agora.chat.ChatMessage.isNeedGroupAck | ( | ) |
消息是否需要群组已读回执。
true
:需要已读回执;false
:不需要已读回执。 boolean io.agora.chat.ChatMessage.isOnlineState | ( | ) |
是否为在线消息。
boolean io.agora.chat.ChatMessage.isUnread | ( | ) |
检查消息是否未读。
true
: 消息未读;false
: 消息已读。 long io.agora.chat.ChatMessage.localTime | ( | ) |
获取消息的本地时间戳。
int io.agora.chat.ChatMessage.progress | ( | ) |
消息包含附件的上传或者下载进度,值的范围 0-100。 消息附件的缩略图不涉及进度信息。
void io.agora.chat.ChatMessage.setAcked | ( | boolean | isAcked | ) |
设置对方是否已读。 开发者不应该调用此方法,由 SDK 进行调用。
isAcked | -true : 消息已读。 |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
boolean | value | ||
) |
设置消息的 boolean 类型扩展属性。
attribute | 属性名。 |
value | 属性值。 |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
double | value | ||
) |
设置消息的 double 类型扩展属性。
attribute | 属性名。 |
value | 属性值。 |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
float | value | ||
) |
设置消息的 float 类型扩展属性。
attribute | 属性名。 |
value | 属性值。 |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
int | value | ||
) |
设置消息的 int 类型扩展属性。
attribute | 属性名。 |
value | 属性值。 |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
JSONArray | value | ||
) |
设置消息的 JSONArray 类型扩展属性。
attribute | 属性名。 |
value | 属性值。 |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
JSONObject | value | ||
) |
设置消息的 JSONObject 类型扩展属性。
attribute | 属性名。 |
value | 属性值。 |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
long | value | ||
) |
设置消息的 long 类型扩展属性。
attribute | 属性名。 |
value | 属性值。 |
void io.agora.chat.ChatMessage.setAttribute | ( | String | attribute, |
String | value | ||
) |
设置消息的 string 类型扩展属性。
attribute | 属性名。 |
value | 属性值。 |
void io.agora.chat.ChatMessage.setBody | ( | MessageBody | body | ) |
(建议方法)设置消息体。
body | 消息体。 |
void io.agora.chat.ChatMessage.setChatType | ( | ChatType | chatType | ) |
设置聊天类型。 默认为单聊 ChatType#Chat。
chatType | 聊天类型,详见 ChatType。 |
void io.agora.chat.ChatMessage.setDeliverAcked | ( | boolean | isDeliverAcked | ) |
设置消息已送达标记。 开发者不要调用,由 SDK 内部调用。
isDeliverAcked | - true :消息已送达。
|
void io.agora.chat.ChatMessage.setDelivered | ( | boolean | isDelivered | ) |
设置消息是否已经送达对方。 开发者不要调用,由 SDK 内部调用。
isDelivered | - true : 已送达。 |
void io.agora.chat.ChatMessage.setFrom | ( | String | from | ) |
设置消息发送者 ID。
from | 发送者 ID。 |
void io.agora.chat.ChatMessage.setGroupAckCount | ( | int | count | ) |
设置群消息已读人数。
count | 群消息已读人数。 |
void io.agora.chat.ChatMessage.setIsChatThreadMessage | ( | boolean | isChatThreadMessage | ) |
设置是否是 Thread 消息
isChatThreadMessage |
void io.agora.chat.ChatMessage.setIsNeedGroupAck | ( | boolean | need | ) |
设置消息是否需要群组已读回执。
need | - true :需要已读回执;
|
void io.agora.chat.ChatMessage.setListened | ( | boolean | isListened | ) |
设置语音是否已听。
开发者不要调用,由 SDK 内部调用。
isListened | - true :设置消息为已听。
|
void io.agora.chat.ChatMessage.setLocalTime | ( | long | serverTime | ) |
设置消息的本地时间戳。
serverTime | 消息的本地时间戳。 |
synchronized void io.agora.chat.ChatMessage.setMessageStatusCallback | ( | CallBack | callback | ) |
设置消息状态改变的回调。 设置消息状态回调,以便刷新界面。
callback | 消息状态改变的回调。 |
void io.agora.chat.ChatMessage.setMsgId | ( | String | msgId | ) |
设置本地消息 ID。
msgId | 消息 ID。 |
void io.agora.chat.ChatMessage.setMsgTime | ( | long | msgTime | ) |
设置消息的时间戳(服务器时间)。
msgTime | 消息的时间戳(服务器时间)。 |
void io.agora.chat.ChatMessage.setProgress | ( | int | progress | ) |
设置消息包含附件的上传或者下载进度,值的范围 0-100。 对于 app 开发者来说,通常不需要主动设置进度。参考:ChatMessage#progress()
progress | 上传或者下载进度。 |
void io.agora.chat.ChatMessage.setStatus | ( | Status | status | ) |
设置消息发送或接收的状态。
status | 消息的状态。 |
void io.agora.chat.ChatMessage.setTo | ( | String | to | ) |
设置消息的接收者用户 ID。
to | 消息接收者用户 ID。 |
void io.agora.chat.ChatMessage.setUnread | ( | boolean | unread | ) |
Status io.agora.chat.ChatMessage.status | ( | ) |
获取消息的发送/接收状态。
|
static |