agora_chat_SDK 1.0.6
agora java chat SDK
|
Public 成员函数 | |
void | sendMessage (final ChatMessage msg) |
void | ackConversationRead (String conversationId) throws ChatException |
void | ackMessageRead (String to, String messageId) throws ChatException |
void | ackGroupMessageRead (String to, String messageId, String ext) throws ChatException |
void | recallMessage (ChatMessage message) throws ChatException |
void | aysncRecallMessage (final ChatMessage message, final CallBack callback) |
ChatMessage | getMessage (String messageId) |
Conversation | getConversation (String id) |
Conversation | getConversation (String id, ConversationType type) |
Conversation | getConversation (String username, ConversationType type, boolean createIfNotExists) |
Conversation | getConversation (String username, ConversationType type, boolean createIfNotExists, boolean isChatThread) |
void | markAllConversationsAsRead () |
int | getUnreadMsgsCount () |
int | getUnreadMessageCount () |
void | saveMessage (ChatMessage message) |
boolean | updateMessage (ChatMessage message) |
void | downloadAttachment (final ChatMessage msg) |
void | downloadThumbnail (final ChatMessage msg) |
synchronized void | importMessages (List< ChatMessage > msgs) |
List< Conversation > | getConversationsByType (ConversationType type) |
void | downloadFile (final String remoteUrl, final String localFilePath, final Map< String, String > headers, final CallBack callback) |
Map< String, Conversation > | getAllConversations () |
Map< String, Conversation > | fetchConversationsFromServer () throws ChatException |
void | asyncFetchConversationsFromServer (final ValueCallBack< Map< String, Conversation > > callBack) |
void | loadAllConversations () |
boolean | deleteConversation (String username, boolean deleteMessages) |
void | deleteConversationFromServer (String username, ConversationType type, boolean isDeleteServerMessages, CallBack deleteCallBack) |
void | addMessageListener (MessageListener listener) |
void | removeMessageListener (MessageListener listener) |
void | addConversationListener (ConversationListener listener) |
void | removeConversationListener (ConversationListener listener) |
void | setMessageListened (ChatMessage message) |
void | setVoiceMessageListened (ChatMessage message) |
boolean | updateParticipant (String from, String changeTo) |
CursorResult< GroupReadAck > | fetchGroupReadAcks (String msgId, int pageSize, String startAckId) throws ChatException |
void | asyncFetchGroupReadAcks (final String msgId, final int pageSize, final String startAckId, final ValueCallBack< CursorResult< GroupReadAck > > callBack) |
CursorResult< ChatMessage > | fetchHistoryMessages (String conversationId, ConversationType type, int pageSize, String startMsgId) throws ChatException |
CursorResult< ChatMessage > | fetchHistoryMessages (String conversationId, ConversationType type, int pageSize, String startMsgId, Conversation.SearchDirection direction) throws ChatException |
void | asyncFetchHistoryMessage (final String conversationId, final ConversationType type, final int pageSize, final String startMsgId, final ValueCallBack< CursorResult< ChatMessage > > callBack) |
void | asyncFetchHistoryMessage (final String conversationId, final ConversationType type, final int pageSize, final String startMsgId, final Conversation.SearchDirection direction, final ValueCallBack< CursorResult< ChatMessage > > callBack) |
List< ChatMessage > | searchMsgFromDB (ChatMessage.Type type, long timeStamp, int maxCount, String from, Conversation.SearchDirection direction) |
List< ChatMessage > | searchMsgFromDB (String keywords, long timeStamp, int maxCount, String from, Conversation.SearchDirection direction) |
void | deleteMessagesBeforeTimestamp (long timeStamp, CallBack callback) |
void | asyncReportMessage (String msgId, String reportTarget, String reportReason, CallBack callBack) |
void | reportMessage (String msgId, String reportTarget, String reportReason) throws ChatException |
void | fetchSupportLanguages (ValueCallBack< List< Language > > callBack) |
void | translateMessage (ChatMessage message, List< String > languages, ValueCallBack< ChatMessage > callBack) |
void | addReaction (final String messageId, final String reaction) throws ChatException |
void | asyncAddReaction (final String messageId, final String reaction, final CallBack callback) |
void | removeReaction (final String messageId, final String reaction) throws ChatException |
void | asyncRemoveReaction (final String messageId, final String reaction, final CallBack callback) |
Map< String, List< MessageReaction > > | getReactionList (final List< String > messageIdList, final ChatMessage.ChatType chatType, final String groupId) throws ChatException |
void | asyncGetReactionList (final List< String > messageIdList, final ChatMessage.ChatType chatType, final String groupId, final ValueCallBack< Map< String, List< MessageReaction > > > callback) |
CursorResult< MessageReaction > | getReactionDetail (final String messageId, final String reaction, final String cursor, final int pageSize) throws ChatException |
void | asyncGetReactionDetail (final String messageId, final String reaction, final String cursor, final int pageSize, final ValueCallBack< CursorResult< MessageReaction > > callback) |
Protected 成员函数 | |
ChatManager (ChatClient client, EMAChatManager manager, EMAReactionManager reactionManager) | |
聊天管理类,该类负责管理会话(加载,删除等)、发送消息、下载消息附件等。
比如,发送一条文本消息:
void io.agora.chat.ChatManager.ackConversationRead | ( | String | conversationId | ) | throws ChatException |
发送会话的已读回执,该方法只针对单聊会话。
该方法会通知服务器将此会话未读数设置为 0,对话方(包含多端多设备)将会在下面这个回调方法中接收到回调:
ConversationListener#onConversationRead(String, String) 。
参考: 群消息已读回执,详见 ackGroupMessageRead(String, String, String)。
conversationId | 会话 ID。 |
ChatException | 以下为可能抛出的异常:Error#USER_NOT_LOGIN、Error#SERVER_NOT_REACHABLE、 Error#MESSAGE_INVALID 等,详见 Error。 |
void io.agora.chat.ChatManager.ackGroupMessageRead | ( | String | to, |
String | messageId, | ||
String | ext | ||
) | throws ChatException |
发送群消息已读回执。
前提条件:设置了 ChatOptions#setRequireAck(boolean) 和 ChatMessage#setIsNeedGroupAck(boolean)。
参考: 发送单聊消息已读回执,详见 ackMessageRead(String, String) ; 会话已读回执,详见 ackConversationRead(String)。
to | 会话 ID。 |
messageId | 消息 ID。 |
ext | 扩展信息。ext 属性是用户自己定义的关键字,接收后,解析出自定义的字符串,可以自行处理。 |
ChatException | 如果有异常会在这里抛出,包含错误码和错误描述,详见 Error。 |
void io.agora.chat.ChatManager.ackMessageRead | ( | String | to, |
String | messageId | ||
) | throws ChatException |
发送消息的已读回执。
该方法仅适用于单聊会话。
注意:如果设置 ChatOptions#setRequireAck(boolean) 为 false
,当前方法将失效。
发送群消息已读回执,详见 ackGroupMessageRead(String, String, String)。
建议:在进入聊天页面的时调用 ackConversationRead(String) ,其他场景再调用此方法,可以大量减少调用此方法的次数。
to | 接收方的用户名。 |
messageId | 消息的 ID。 |
ChatException | 如果有异常会在这里抛出,包含错误码和错误描述,详见 Error。 |
void io.agora.chat.ChatManager.addConversationListener | ( | ConversationListener | listener | ) |
注册会话监听。
用于监听会话变化及监听会话已读回执,详见 ConversationListener。
需要配合 removeConversationListener(ConversationListener) 使用。
listener | 要添加的会话监听,详见 ConversationListener。 |
void io.agora.chat.ChatManager.addMessageListener | ( | MessageListener | listener | ) |
注册消息监听。
接受到新消息等回调可以通过设置此方法进行监听,详见 MessageListener。
如果需要移除监听,可以和 removeMessageListener(MessageListener) 方法配合使用。
listener | 要注册的消息监听,详见 MessageListener。 |
void io.agora.chat.ChatManager.addReaction | ( | final String | messageId, |
final String | reaction | ||
) | throws ChatException |
添加 Reaction。
同步方法。
messageId | 消息 ID。 |
reaction | 消息 Reaction 内容。 |
void io.agora.chat.ChatManager.asyncAddReaction | ( | final String | messageId, |
final String | reaction, | ||
final CallBack | callback | ||
) |
void io.agora.chat.ChatManager.asyncFetchConversationsFromServer | ( | final ValueCallBack< Map< String, Conversation > > | callBack | ) |
从服务器获取会话列表。 该功能需联系商务开通,开通后,用户默认可拉取 7 天内的 10 个会话(每个会话包含最新一条历史消息),如需调整会话数量或时间限制请联系商务经理。
异步方法。
void io.agora.chat.ChatManager.asyncFetchGroupReadAcks | ( | final String | msgId, |
final int | pageSize, | ||
final String | startAckId, | ||
final ValueCallBack< CursorResult< GroupReadAck > > | callBack | ||
) |
从服务器获取群组消息回执详情。
分页获取。
参考: 发送群组消息回执,详见 ackGroupMessageRead(String, String, String)。
异步方法。
msgId | 消息 ID。 |
pageSize | 每页获取群消息已读回执的条数。 |
startAckId | 已读回执的 ID,如果为空,从最新的回执向前开始获取。 |
callBack | 结果回调,成功执行 ValueCallBack#onSuccess(Object),失败执行 ValueCallBack#onError(int, String)。 |
void io.agora.chat.ChatManager.asyncFetchHistoryMessage | ( | final String | conversationId, |
final ConversationType | type, | ||
final int | pageSize, | ||
final String | startMsgId, | ||
final Conversation.SearchDirection | direction, | ||
final ValueCallBack< CursorResult< ChatMessage > > | callBack | ||
) |
从服务器获取历史消息。
分页获取。
异步方法。
conversationId | 会话 ID。 |
type | 会话类型,详见 ConversationType。 |
pageSize | 每页获取的条数。 |
startMsgId | 漫游消息的开始消息 ID,如果为空,根据 direction , 当检索方向为 io.agora.chat.Conversation.SearchDirection#UP 时, 从最新的消息向前开始获取;当检索方向为 io.agora.chat.Conversation.SearchDirection#DOWN 时, 从最旧的消息向后开始获取。 |
direction | 漫游消息检索方向,io.agora.chat.Conversation.SearchDirection#UP为检索 时间戳消息小于开始消息时间戳的消息,io.agora.chat.Conversation.SearchDirection#DOWN 为检索时间戳消息大于开始消息时间戳的消息。 |
callBack | 结果回调,成功则执行 ValueCallBack#onSuccess(Object), 返回消息列表和用于继续获取历史消息的 Cursor; 失败则执行 ValueCallBack#onError(int, String)。 |
void io.agora.chat.ChatManager.asyncFetchHistoryMessage | ( | final String | conversationId, |
final ConversationType | type, | ||
final int | pageSize, | ||
final String | startMsgId, | ||
final ValueCallBack< CursorResult< ChatMessage > > | callBack | ||
) |
从服务器获取历史消息。
分页获取。
异步方法。
conversationId | 会话 ID。 |
type | 会话类型,详见 ConversationType。 |
pageSize | 每页获取的条数。 |
startMsgId | 漫游消息的开始消息 ID,如果为空,从最新的消息向前开始获取。 |
callBack | 结果回调,成功则执行 ValueCallBack#onSuccess(Object), 返回消息列表和用于继续获取历史消息的 Cursor; 失败则执行 ValueCallBack#onError(int, String)。 |
void io.agora.chat.ChatManager.asyncGetReactionDetail | ( | final String | messageId, |
final String | reaction, | ||
final String | cursor, | ||
final int | pageSize, | ||
final ValueCallBack< CursorResult< MessageReaction > > | callback | ||
) |
获取 Reaction 详细信息。
异步方法。
messageId | 消息 ID。 |
reaction | 消息 Reaction。 |
cursor | 查询 cursor。 |
pageSize | 每页获取的 Reaction 条数。 |
callback | 处理结果回调,包含 cursor 和 MessageReaction 列表(仅使用该列表第一个数据即可)。 |
void io.agora.chat.ChatManager.asyncGetReactionList | ( | final List< String > | messageIdList, |
final ChatMessage.ChatType | chatType, | ||
final String | groupId, | ||
final ValueCallBack< Map< String, List< MessageReaction > > > | callback | ||
) |
获取 Reaction 列表。
异步方法。
messageIdList | 消息 ID。 |
chatType | 会话类型,仅支持单聊( ChatMessage.ChatType#Chat )和群聊(ChatMessage.ChatType#GroupChat)。 |
groupId | 群组 ID,该参数只在群聊生效。 |
callback | 处理结果回调,包含消息 ID 对应的 Reaction 列表(MessageReaction 的用户列表为概要数据,只包含前三个用户信息)。 |
void io.agora.chat.ChatManager.asyncRemoveReaction | ( | final String | messageId, |
final String | reaction, | ||
final CallBack | callback | ||
) |
void io.agora.chat.ChatManager.asyncReportMessage | ( | String | msgId, |
String | reportTarget, | ||
String | reportReason, | ||
CallBack | callBack | ||
) |
举报违规消息
msgId | 违规的消息id。 |
reportTarget | 举报类型(例如:涉黄、涉恐) |
reportReason | 举报原因。 |
callBack | 执行上报结果 成功执行 CallBack#onSuccess(),失败执行CallBack#onError(int, String) |
void io.agora.chat.ChatManager.aysncRecallMessage | ( | final ChatMessage | message, |
final CallBack | callback | ||
) |
boolean io.agora.chat.ChatManager.deleteConversation | ( | String | username, |
boolean | deleteMessages | ||
) |
删除指定 ID 的对话和本地的聊天记录。 如果将 deleteMessages
设为 true
,删除会话的同时也会删除本地的聊天记录。
username | 会话 ID。 |
deleteMessages | 是否同时删除本地的聊天记录。
|
删除会话结果。
true
代表删除成功;
false
代表删除失败。
void io.agora.chat.ChatManager.deleteConversationFromServer | ( | String | username, |
ConversationType | type, | ||
boolean | isDeleteServerMessages, | ||
CallBack | deleteCallBack | ||
) |
删除服务端的指定 ID 的对话和聊天记录,内部异步操作。
username | 会话 ID。 |
type | 会话类型 ConversationType |
isDeleteServerMessages | 是否同时删除服务端的聊天记录。
|
deleteCallBack | 删除服务端会话与记录成功与否的回调。
|
void io.agora.chat.ChatManager.deleteMessagesBeforeTimestamp | ( | long | timeStamp, |
CallBack | callback | ||
) |
删除时间戳之前的本地消息记录。
timeStamp | Unix 时间戳,单位为毫秒。 |
callback | 删除结果回调,详见 CallBack。 |
void io.agora.chat.ChatManager.downloadAttachment | ( | final ChatMessage | msg | ) |
下载消息的附件。
未成功下载的附件,可调用此方法再次下载。
msg | 要下载附件的消息。 |
void io.agora.chat.ChatManager.downloadFile | ( | final String | remoteUrl, |
final String | localFilePath, | ||
final Map< String, String > | headers, | ||
final CallBack | callback | ||
) |
从服务器下载文件。
remoteUrl | 服务器上的远程文件路径。 |
localFilePath | 本地要生成的文件路径。 |
headers | 请求头。 |
callback | 下载结果回调,详见 CallBack。 |
void io.agora.chat.ChatManager.downloadThumbnail | ( | final ChatMessage | msg | ) |
下载消息的缩略图。
msg | 要下载缩略图的消息,一般图片消息和视频消息有缩略图。 |
Map< String, Conversation > io.agora.chat.ChatManager.fetchConversationsFromServer | ( | ) | throws ChatException |
从服务器获取会话列表。 该功能需联系商务开通,开通后,用户默认可拉取 7 天内的 10 个会话(每个会话包含最新一条历史消息),如需调整会话数量或时间限制请联系商务经理。
同步方法,会阻塞当前线程。
CursorResult< GroupReadAck > io.agora.chat.ChatManager.fetchGroupReadAcks | ( | String | msgId, |
int | pageSize, | ||
String | startAckId | ||
) | throws ChatException |
从服务器获取群组消息回执详情。
分页获取。
参考: 发送群组消息回执,详见 ackGroupMessageRead(String, String, String)。
同步方法,会阻塞当前线程。
msgId | 需要获取回执的消息 ID。 |
pageSize | 每次获取群消息已读回执的条数。 |
startAckId | 已读回执的 ID,可以为空。如果为空,从最新的回执向前开始获取。 |
ChatException | 如果有异常会在这里抛出,包含错误码和错误描述,详见 Error。 |
CursorResult< ChatMessage > io.agora.chat.ChatManager.fetchHistoryMessages | ( | String | conversationId, |
ConversationType | type, | ||
int | pageSize, | ||
String | startMsgId | ||
) | throws ChatException |
从服务器获取历史消息。
分页获取。
同步方法,会阻塞当前线程。
conversationId | 会话 ID。 |
type | 会话类型, 详见 ConversationType。 |
pageSize | 每页获取的条数。 |
startMsgId | 漫游消息的开始消息 ID,如果为空,从最新的消息向前开始获取。 |
ChatException | 如果有异常会在这里抛出,包含错误码和错误描述,详见 Error。 |
CursorResult< ChatMessage > io.agora.chat.ChatManager.fetchHistoryMessages | ( | String | conversationId, |
ConversationType | type, | ||
int | pageSize, | ||
String | startMsgId, | ||
Conversation.SearchDirection | direction | ||
) | throws ChatException |
从服务器获取历史消息。
分页获取。
同步方法,会阻塞当前线程。
conversationId | 会话 ID。 |
type | 会话类型, 详见 ConversationType。 |
pageSize | 每页获取的条数。 |
startMsgId | 漫游消息的开始消息 ID,如果为空,根据 direction , 当检索方向为 io.agora.chat.Conversation.SearchDirection#UP 时, 从最新的消息向前开始获取;当检索方向为 io.agora.chat.Conversation.SearchDirection#DOWN 时, 从最旧的消息向后开始获取。 |
direction | 漫游消息检索方向,io.agora.chat.Conversation.SearchDirection#UP为检索 时间戳消息小于开始消息时间戳的消息,io.agora.chat.Conversation.SearchDirection#DOWN 为检索时间戳消息大于开始消息时间戳的消息。 |
ChatException | 如果有异常会在这里抛出,包含错误码和错误描述,详见 Error。 |
void io.agora.chat.ChatManager.fetchSupportLanguages | ( | ValueCallBack< List< Language > > | callBack | ) |
获取翻译服务支持的语言
callBack | 完成回调 |
Map< String, Conversation > io.agora.chat.ChatManager.getAllConversations | ( | ) |
从本地获取当前所有的会话。
先从内存中加载,如果内存中没有再从数据库中加载。
Conversation io.agora.chat.ChatManager.getConversation | ( | String | id | ) |
获取定义 ID 的会话对象。
没有找到会返回空值。
id | 会话 ID。 |
Conversation io.agora.chat.ChatManager.getConversation | ( | String | id, |
ConversationType | type | ||
) |
根据会话 ID 以及会话类型获取会话。
没有找到返回空值。
id | 会话 ID。 |
type | 会话类型。 |
Conversation io.agora.chat.ChatManager.getConversation | ( | String | username, |
ConversationType | type, | ||
boolean | createIfNotExists | ||
) |
根据用户或群组 ID 以及会话类型获取会话。
没有找到的话,可以根据 createIfNotExists 的值返回一个新建对象或者空对象。
username | 会话 ID。 |
type | 会话类型。 |
createIfNotExists | 没找到相应会话时是否自动创建。
|
Conversation io.agora.chat.ChatManager.getConversation | ( | String | username, |
ConversationType | type, | ||
boolean | createIfNotExists, | ||
boolean | isChatThread | ||
) |
根据用户或群组id以及会话类型获取会话。
没有找到的话,根据createIfNotExists的值返回一个新建对象或者空对象。
username | 会话ID。 |
type | 会话类型。 |
createIfNotExists | 没找到相应会话时是否自动创建。
|
isChatThread | 是否查找子区会话。
|
List< Conversation > io.agora.chat.ChatManager.getConversationsByType | ( | ConversationType | type | ) |
ChatMessage io.agora.chat.ChatManager.getMessage | ( | String | messageId | ) |
获取指定 ID 的消息对象。
messageId | 消息 ID。 |
CursorResult< MessageReaction > io.agora.chat.ChatManager.getReactionDetail | ( | final String | messageId, |
final String | reaction, | ||
final String | cursor, | ||
final int | pageSize | ||
) | throws ChatException |
获取 Reaction 详细信息。
同步方法。
messageId | 消息 ID。 |
reaction | 消息 Reaction 内容。 |
cursor | 查询 cursor。 |
pageSize | 每页获取的 Reaction 条数。 |
cursor | 返回 cursor 和 MessageReaction 列表(仅使用该列表第一个数据即可)。cursor 为空值说明数据已全部获取到。 |
Map< String, List< MessageReaction > > io.agora.chat.ChatManager.getReactionList | ( | final List< String > | messageIdList, |
final ChatMessage.ChatType | chatType, | ||
final String | groupId | ||
) | throws ChatException |
获取 Reaction 列表。
同步方法。
messageIdList | 消息 ID。 |
chatType | 会话类型,仅支持单聊( ChatMessage.ChatType#Chat )和群聊(ChatMessage.ChatType#GroupChat)。 |
groupId | 群组 ID,该参数只在群聊生效。 |
int io.agora.chat.ChatManager.getUnreadMessageCount | ( | ) |
获取未读消息数。
int io.agora.chat.ChatManager.getUnreadMsgsCount | ( | ) |
synchronized void io.agora.chat.ChatManager.importMessages | ( | List< ChatMessage > | msgs | ) |
向消息数据库导入多条聊天记录。 在调用此函数时要保证,消息的发送方或者接收方是当前用户。 已经对函数做过速度优化,推荐一次导入 1,000 条以内的数据。
msgs | 需要导入数据库的消息。 |
void io.agora.chat.ChatManager.loadAllConversations | ( | ) |
从数据库加载本地所有的会话到内存中。 一般在登录成功后使用此方法,可以加快会话列表的加载速度。
void io.agora.chat.ChatManager.markAllConversationsAsRead | ( | ) |
把所有的会话都设成已读。
这里针对的是本地会话。
void io.agora.chat.ChatManager.recallMessage | ( | ChatMessage | message | ) | throws ChatException |
void io.agora.chat.ChatManager.removeConversationListener | ( | ConversationListener | listener | ) |
移除会话监听。
如果想要移除会话监听,需要先添加 addConversationListener(ConversationListener) 后调用此方法进行移除。
listener | 准备移除的会话监听,详见 ConversationListener。 |
void io.agora.chat.ChatManager.removeMessageListener | ( | MessageListener | listener | ) |
void io.agora.chat.ChatManager.removeReaction | ( | final String | messageId, |
final String | reaction | ||
) | throws ChatException |
删除 Reaction。
同步方法。
messageId | 消息 ID。 |
reaction | 消息 Reaction。 |
ChatException | 如果有异常会在这里抛出,包含错误码和错误描述,详见 Error。 |
void io.agora.chat.ChatManager.reportMessage | ( | String | msgId, |
String | reportTarget, | ||
String | reportReason | ||
) | throws ChatException |
举报违规消息。
同步方法,会阻塞当前线程。
msgId | 违规的消息id。 |
reportTarget | 举报类型(例如:涉黄、涉恐) |
reportReason | 举报原因。 |
ChatException | 如果有异常会在这里抛出,包含错误码和错误描述,详见 Error。 |
void io.agora.chat.ChatManager.saveMessage | ( | ChatMessage | message | ) |
保存消息到本地。 比如系统提示消息会存到内存中的会话和数据库。
注意: CMD 类型数据不保存在本地。
message | 待存储的消息。 |
List< ChatMessage > io.agora.chat.ChatManager.searchMsgFromDB | ( | ChatMessage.Type | type, |
long | timeStamp, | ||
int | maxCount, | ||
String | from, | ||
Conversation.SearchDirection | direction | ||
) |
根据传入的参数从本地存储中搜索指定数量的消息。
注意:当 maxCount 非常大时,需要考虑内存消耗,目前限制一次最多搜索 400 条数据。
type | 消息类型,文本、图片、语音、视频等,详见 ChatMessage.Type。 |
timeStamp | 搜索消息的时间点,Unix 时间戳。 |
maxCount | 搜索结果的最大条数。 |
from | 搜索来自某人或者某群的消息,一般是指会话 ID。 |
List< ChatMessage > io.agora.chat.ChatManager.searchMsgFromDB | ( | String | keywords, |
long | timeStamp, | ||
int | maxCount, | ||
String | from, | ||
Conversation.SearchDirection | direction | ||
) |
根据传入的参数从本地存储中搜索指定数量的消息。
注意:当 maxCount 非常大时,需要考虑内存消耗,目前限制一次最多搜索 400 条数据。
keywords | 搜索消息中的关键词。 |
timeStamp | 搜索消息的时间点。 |
maxCount | 一次搜索结果的最大条数。 |
from | 搜索来自某人或者某群的消息,一般是指会话 ID。 |
void io.agora.chat.ChatManager.sendMessage | ( | final ChatMessage | msg | ) |
发送消息。
参考: 如果是语音,图片类等有附件的消息,SDK 会自动上传附件。 可以通过 ChatOptions#setAutoTransferMessageAttachments(boolean) 设置是否上传到聊天服务器。
发送消息的状态,可以通过设置 ChatMessage#setMessageStatusCallback(CallBack) 进行监听。
msg | 待发送消息对象,不能为空。 |
void io.agora.chat.ChatManager.setMessageListened | ( | ChatMessage | message | ) |
void io.agora.chat.ChatManager.setVoiceMessageListened | ( | ChatMessage | message | ) |
将消息设置为已听。 一般用于语音消息。
message | 要设置的消息对象。 |
void io.agora.chat.ChatManager.translateMessage | ( | ChatMessage | message, |
List< String > | languages, | ||
ValueCallBack< ChatMessage > | callBack | ||
) |
翻译消息
message | 消息对象 |
languages | 要翻译的目标语言code列表 |
callBack | 完成回调 |
boolean io.agora.chat.ChatManager.updateMessage | ( | ChatMessage | message | ) |
更新本地消息。
会更新本地内存和数据库。
message | 要更新的消息对象。 |
boolean io.agora.chat.ChatManager.updateParticipant | ( | String | from, |
String | changeTo | ||
) |
将数据库中的某个联系人相关信息变更成另外一个联系人。
与变更相关的表单包含消息表单,会话表单,联系人表单,黑名单表单。
注意:该操作不会更新内存中数据。
from | 更换前的用户 ID。 |
changeTo | 更换后的用户 ID。 |
false
。