hyphenate_SDK3.0
3.8.1
hyphenatejavaIMSDK
|
Public 成员函数 | |
void | sendMessage (final EMMessage msg) |
void | ackConversationRead (String conversationId) throws HyphenateException |
void | ackMessageRead (String to, String messageId) throws HyphenateException |
void | ackGroupMessageRead (String to, String messageId, String ext) throws HyphenateException |
void | recallMessage (EMMessage message) throws HyphenateException |
void | aysncRecallMessage (final EMMessage message, final EMCallBack callback) |
EMMessage | getMessage (String messageId) |
EMConversation | getConversation (String id) |
EMConversation | getConversation (String id, EMConversationType type) |
EMConversation | getConversation (String username, EMConversationType type, boolean createIfNotExists) |
void | markAllConversationsAsRead () |
int | getUnreadMsgsCount () |
int | getUnreadMessageCount () |
void | saveMessage (EMMessage message) |
boolean | updateMessage (EMMessage message) |
void | downloadAttachment (final EMMessage msg) |
void | downloadThumbnail (final EMMessage msg) |
synchronized void | importMessages (List< EMMessage > msgs) |
List< EMConversation > | getConversationsByType (EMConversationType type) |
void | downloadFile (final String remoteUrl, final String localFilePath, final Map< String, String > headers, final EMCallBack callback) |
Map< String, EMConversation > | getAllConversations () |
Map< String, EMConversation > | fetchConversationsFromServer () throws HyphenateException |
void | asyncFetchConversationsFromServer (final EMValueCallBack< Map< String, EMConversation >> callBack) |
void | loadAllConversations () |
boolean | deleteConversation (String username, boolean deleteMessages) |
void | addMessageListener (EMMessageListener listener) |
void | removeMessageListener (EMMessageListener listener) |
void | addConversationListener (EMConversationListener listener) |
void | removeConversationListener (EMConversationListener listener) |
void | setMessageListened (EMMessage message) |
void | setVoiceMessageListened (EMMessage message) |
boolean | updateParticipant (String from, String changeTo) |
EMCursorResult< EMGroupReadAck > | fetchGroupReadAcks (String msgId, int pageSize, String startAckId) throws HyphenateException |
void | asyncFetchGroupReadAcks (final String msgId, final int pageSize, final String startAckId, final EMValueCallBack< EMCursorResult< EMGroupReadAck >> callBack) |
EMCursorResult< EMMessage > | fetchHistoryMessages (String conversationId, EMConversationType type, int pageSize, String startMsgId) throws HyphenateException |
void | asyncFetchHistoryMessage (final String conversationId, final EMConversationType type, final int pageSize, final String startMsgId, final EMValueCallBack< EMCursorResult< EMMessage >> callBack) |
List< EMMessage > | searchMsgFromDB (EMMessage.Type type, long timeStamp, int maxCount, String from, EMConversation.EMSearchDirection direction) |
List< EMMessage > | searchMsgFromDB (String keywords, long timeStamp, int maxCount, String from, EMConversation.EMSearchDirection direction) |
Protected 成员函数 | |
EMChatManager (EMClient client, EMAChatManager manager) | |
void com.hyphenate.chat.EMChatManager.ackConversationRead | ( | String | conversationId | ) | throws HyphenateException |
发送会话已读消息,将通知服务器将此会话未读数置为0
conversationId | 会话id |
HyphenateException |
void com.hyphenate.chat.EMChatManager.ackMessageRead | ( | String | to, |
String | messageId | ||
) | throws HyphenateException |
发送消息已读回执
to | 接收方的用户名 |
messageId | 消息的ID |
HyphenateException |
void com.hyphenate.chat.EMChatManager.addConversationListener | ( | EMConversationListener | listener | ) |
注册会话监听
listener |
void com.hyphenate.chat.EMChatManager.addMessageListener | ( | EMMessageListener | listener | ) |
注册消息监听
listener |
void com.hyphenate.chat.EMChatManager.asyncFetchConversationsFromServer | ( | final EMValueCallBack< Map< String, EMConversation >> | callBack | ) |
从服务器获取会话列表,默认最多返回100条数据
void com.hyphenate.chat.EMChatManager.asyncFetchGroupReadAcks | ( | final String | msgId, |
final int | pageSize, | ||
final String | startAckId, | ||
final EMValueCallBack< EMCursorResult< EMGroupReadAck >> | callBack | ||
) |
从服务器获取群组消息回执详情
msgId | 消息id |
pageSize | 获取的页面大小 |
startAckId | 已读回执的id,如果为空,从最新的回执向前开始获取 |
void com.hyphenate.chat.EMChatManager.asyncFetchHistoryMessage | ( | final String | conversationId, |
final EMConversationType | type, | ||
final int | pageSize, | ||
final String | startMsgId, | ||
final EMValueCallBack< EMCursorResult< EMMessage >> | callBack | ||
) |
从服务器获取历史消息
conversationId | 会话名称 |
type | 会话类型 |
pageSize | 获取的页面大小 |
startMsgId | 漫游消息的开始消息id,如果为空,从最新的消息向前开始获取 |
callBack | 返回消息列表和用于继续获取历史消息的Cursor |
boolean com.hyphenate.chat.EMChatManager.deleteConversation | ( | String | username, |
boolean | deleteMessages | ||
) |
删除和指定用户或者群聊的对话(包括删除本地的聊天记录)
username | 用户名或者群聊id |
deleteMessages | 是否删除消息 |
void com.hyphenate.chat.EMChatManager.downloadAttachment | ( | final EMMessage | msg | ) |
下载消息的附件,未成功下载的附件,可调用此方法再次下载
msg |
void com.hyphenate.chat.EMChatManager.downloadFile | ( | final String | remoteUrl, |
final String | localFilePath, | ||
final Map< String, String > | headers, | ||
final EMCallBack | callback | ||
) |
从服务器下载文件,推荐使用downloadAttachment(EMMessage msg)替代此函数
remoteUrl | 服务器上的远程文件 |
localFilePath | 本地要生成的文件 |
headers | Http Request Header |
callback | EMCallBack |
void com.hyphenate.chat.EMChatManager.downloadThumbnail | ( | final EMMessage | msg | ) |
下载消息的缩略图
msg |
Map<String, EMConversation> com.hyphenate.chat.EMChatManager.fetchConversationsFromServer | ( | ) | throws HyphenateException |
从服务器获取会话列表,默认最多返回100条数据
同步方法,会阻塞当前线程
EMCursorResult<EMGroupReadAck> com.hyphenate.chat.EMChatManager.fetchGroupReadAcks | ( | String | msgId, |
int | pageSize, | ||
String | startAckId | ||
) | throws HyphenateException |
从服务器获取群组消息回执详情
msgId | 消息id |
pageSize | 获取的页面大小 |
startAckId | 已读回执的id,如果为空,从最新的回执向前开始获取 |
EMCursorResult<EMMessage> com.hyphenate.chat.EMChatManager.fetchHistoryMessages | ( | String | conversationId, |
EMConversationType | type, | ||
int | pageSize, | ||
String | startMsgId | ||
) | throws HyphenateException |
从服务器获取历史消息
conversationId | 会话名称 |
type | 会话类型 |
pageSize | 获取的页面大小 |
startMsgId | 漫游消息的开始消息id,如果为空,从最新的消息向前开始获取 |
Map<String, EMConversation> com.hyphenate.chat.EMChatManager.getAllConversations | ( | ) |
获取当前所有的会话
EMConversation com.hyphenate.chat.EMChatManager.getConversation | ( | String | id | ) |
获取会话,没有则返回null, 没找到则返回空
id | user id or group id |
EMConversation com.hyphenate.chat.EMChatManager.getConversation | ( | String | id, |
EMConversationType | type | ||
) |
根据用户或群组id以及会话类型获取会话,没有找到则返回空
id | 用户或群组id |
type | 会话类型 |
EMConversation com.hyphenate.chat.EMChatManager.getConversation | ( | String | username, |
EMConversationType | type, | ||
boolean | createIfNotExists | ||
) |
根据用户或群组id以及会话类型获取会话
username | 用户或群组id |
type | 会话类型 |
createIfNotExists | 没找到相应会话时是否自动创建 |
List<EMConversation> com.hyphenate.chat.EMChatManager.getConversationsByType | ( | EMConversationType | type | ) |
获取某个类型所有的会话
EMMessage com.hyphenate.chat.EMChatManager.getMessage | ( | String | messageId | ) |
获取指定ID 的消息对象
messageId | 消息ID |
int com.hyphenate.chat.EMChatManager.getUnreadMessageCount | ( | ) |
获取未读消息计数
int com.hyphenate.chat.EMChatManager.getUnreadMsgsCount | ( | ) |
获取未读消息计数
synchronized void com.hyphenate.chat.EMChatManager.importMessages | ( | List< EMMessage > | msgs | ) |
向消息数据库导入多条聊天记录 在调用次函数时要保证,消息的发送方或者接收方是当前用户 已经对函数做过速度优化, 推荐一次导入1000条数据
msgs | 需要导入数据库的消息 |
void com.hyphenate.chat.EMChatManager.loadAllConversations | ( | ) |
同步加载所有的会话,并且每条会话读入EMChatOptions.getNumberOfMessagesLoaded()条消息, 默认是20条以保持兼容
void com.hyphenate.chat.EMChatManager.markAllConversationsAsRead | ( | ) |
把所有的会话都设成已读
void com.hyphenate.chat.EMChatManager.recallMessage | ( | EMMessage | message | ) | throws HyphenateException |
撤回发送成功的消息对象
message | 消息对象 |
void com.hyphenate.chat.EMChatManager.removeConversationListener | ( | EMConversationListener | listener | ) |
移除会话监听
listener |
void com.hyphenate.chat.EMChatManager.removeMessageListener | ( | EMMessageListener | listener | ) |
移除消息监听
listener | 要移除的监听 |
void com.hyphenate.chat.EMChatManager.saveMessage | ( | EMMessage | message | ) |
保存用户app 生成的消息,比如系统提示 消息会存到内存中的conversation 和数据库 CMD类型数据不保存在本地
message | 待存储的消息 |
List<EMMessage> com.hyphenate.chat.EMChatManager.searchMsgFromDB | ( | EMMessage.Type | type, |
long | timeStamp, | ||
int | maxCount, | ||
String | from, | ||
EMConversation.EMSearchDirection | direction | ||
) |
根据传入的参数从本地存储中搜索指定数量的message。 注意:当maxCount非常大时,需要考虑内存消耗
type | 消息类型,文本、图片、语音等等 |
timeStamp | 搜索消息的时间点 |
maxCount | 搜索结果的最大条数 |
from | 搜索来自某人的消息,适用于搜索群组里的消息 |
List<EMMessage> com.hyphenate.chat.EMChatManager.searchMsgFromDB | ( | String | keywords, |
long | timeStamp, | ||
int | maxCount, | ||
String | from, | ||
EMConversation.EMSearchDirection | direction | ||
) |
根据传入的参数从本地存储中搜索指定数量的message。 注意:当maxCount非常大时,需要考虑内存消耗
keywords | 搜索消息中的关键词 |
timeStamp | 搜索消息的时间点 |
maxCount | 搜索结果的最大条数 |
from | 搜索来自某人的消息,适用于搜索群组里的消息 |
void com.hyphenate.chat.EMChatManager.sendMessage | ( | final EMMessage | msg | ) |
异步发送消息 如果是语音,图片类有附件的消息,sdk 会自动上传附件
msg | 待发送消息对象 |
void com.hyphenate.chat.EMChatManager.setMessageListened | ( | EMMessage | message | ) |
设置消息为已听,一般用于语音消息
void com.hyphenate.chat.EMChatManager.setVoiceMessageListened | ( | EMMessage | message | ) |
设置消息为已听,一般用于语音消息
boolean com.hyphenate.chat.EMChatManager.updateMessage | ( | EMMessage | message | ) |
更新消息,消息的内容会被保存到本地
message |
boolean com.hyphenate.chat.EMChatManager.updateParticipant | ( | String | from, |
String | changeTo | ||
) |
将数据库中的某个联系人相关信息变更成另外一个联系人 与变更相关的表单包含消息表单,会话表单,联系人表单,黑名单表单 注意:该操作不会更新内存中数据
from | |
changeTo |