hyphenate_SDK3.0
3.6.0
hyphenatejavaIMSDK
|
Public 成员函数 | |
void | sendMessage (final EMMessage msg) |
void | ackMessageRead (String to, String messageId) 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 () |
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< 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) |
Protected 成员函数 | |
EMChatManager (EMClient client, EMAChatManager manager) | |
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.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 |
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 | 待存储的消息 |
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 |