hyphenate_SDK3.0 3.7.6.3
hyphenate java IM SDK
|
Public Member Functions | |
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 Member Functions | |
EMChatManager (EMClient client, EMAChatManager manager) | |
void com.hyphenate.chat.EMChatManager.ackConversationRead | ( | String | conversationId | ) | throws HyphenateException |
send read conversation ack to server, which makes the conversation read
conversationId | conversation id |
HyphenateException |
void com.hyphenate.chat.EMChatManager.ackMessageRead | ( | String | to, |
String | messageId | ||
) | throws HyphenateException |
send read ack to server
to | the recipient id |
messageId | message id |
HyphenateException |
void com.hyphenate.chat.EMChatManager.addConversationListener | ( | EMConversationListener | listener | ) |
add conversation listener
listener | the conversation listener |
void com.hyphenate.chat.EMChatManager.addMessageListener | ( | EMMessageListener | listener | ) |
add message listener
listener | the message listener which is used to monitor the incoming messages |
void com.hyphenate.chat.EMChatManager.asyncFetchConversationsFromServer | ( | final EMValueCallBack< Map< String, EMConversation > > | callBack | ) |
fetch conversations from server, default maximum return is 100.
void com.hyphenate.chat.EMChatManager.asyncFetchGroupReadAcks | ( | final String | msgId, |
final int | pageSize, | ||
final String | startAckId, | ||
final EMValueCallBack< EMCursorResult< EMGroupReadAck > > | callBack | ||
) |
fetch ack details for group messages from server.
msgId | message id |
pageSize | the page size. |
startAckId | the start id for fetch acks, if empty start from the server lastest ack. |
void com.hyphenate.chat.EMChatManager.asyncFetchHistoryMessage | ( | final String | conversationId, |
final EMConversationType | type, | ||
final int | pageSize, | ||
final String | startMsgId, | ||
final EMValueCallBack< EMCursorResult< EMMessage > > | callBack | ||
) |
fetch conversation roam messages from server.
conversationId | the conversation id which select to fetch roam message. |
type | the conversation type which select to fetch roam message. |
pageSize | the page size. |
startMsgId | the start search roam message, if empty start from the server lastest message. |
callBack | server return messages and cursor for next fetch action. |
boolean com.hyphenate.chat.EMChatManager.deleteConversation | ( | String | username, |
boolean | deleteMessages | ||
) |
delete conversation and messages from local database
username | user id or group id |
deleteMessages | whether delete messages |
void com.hyphenate.chat.EMChatManager.downloadAttachment | ( | final EMMessage | msg | ) |
download the message attachement
msg | message to be downloaded |
void com.hyphenate.chat.EMChatManager.downloadFile | ( | final String | remoteUrl, |
final String | localFilePath, | ||
final Map< String, String > | headers, | ||
final EMCallBack | callback | ||
) |
download the file from server. Recommend using downloadAttachment(EMMessage msg) instead of this function.
remoteUrl | the remote file url |
localFilePath | the local file path |
headers | Http Request Headers |
callback | EMCallBack |
void com.hyphenate.chat.EMChatManager.downloadThumbnail | ( | final EMMessage | msg | ) |
download the thumbnail if not downloaded before
msg | the message to be downloaded |
Map< String, EMConversation > com.hyphenate.chat.EMChatManager.fetchConversationsFromServer | ( | ) | throws HyphenateException |
fetch conversations from server, default maximum return is 100.
Synchronization method will block the current thread
EMCursorResult< EMGroupReadAck > com.hyphenate.chat.EMChatManager.fetchGroupReadAcks | ( | String | msgId, |
int | pageSize, | ||
String | startAckId | ||
) | throws HyphenateException |
fetch ack details for group messages from server.
msgId | message id |
pageSize | the page size. |
startAckId | the start id for fetch acks, if empty start from the server lastest ack. |
EMCursorResult< EMMessage > com.hyphenate.chat.EMChatManager.fetchHistoryMessages | ( | String | conversationId, |
EMConversationType | type, | ||
int | pageSize, | ||
String | startMsgId | ||
) | throws HyphenateException |
fetch conversation roam messages from server.
conversationId | the conversation id which select to fetch roam message. |
type | the conversation type which select to fetch roam message. |
pageSize | the page size. |
startMsgId | the start search roam message, if empty start from the server lastest message. |
Map< String, EMConversation > com.hyphenate.chat.EMChatManager.getAllConversations | ( | ) |
get all conversations in the cache
EMConversation com.hyphenate.chat.EMChatManager.getConversation | ( | String | id | ) |
get conversation by id
id | user id, group id or chatroom id |
EMConversation com.hyphenate.chat.EMChatManager.getConversation | ( | String | id, |
EMConversationType | type | ||
) |
get conversation by conversation id and conversation type, create a empty conversation if not found
id | user id, group id or chatroom id |
type |
EMConversation com.hyphenate.chat.EMChatManager.getConversation | ( | String | username, |
EMConversationType | type, | ||
boolean | createIfNotExists | ||
) |
get conversation by conversation id and conversation type
username | user id, group id or chatroom id |
type |
createIfNotExists | create conversation if not exists |
List< EMConversation > com.hyphenate.chat.EMChatManager.getConversationsByType | ( | EMConversationType | type | ) |
get list of conversations by conversation type
type | converation type |
EMMessage com.hyphenate.chat.EMChatManager.getMessage | ( | String | messageId | ) |
get message through message id
messageId | message id |
int com.hyphenate.chat.EMChatManager.getUnreadMessageCount | ( | ) |
get unread message count
int com.hyphenate.chat.EMChatManager.getUnreadMsgsCount | ( | ) |
synchronized void com.hyphenate.chat.EMChatManager.importMessages | ( | List< EMMessage > | msgs | ) |
import messages to local database. Make sure the meessage's sender or receiver is current user Recommend import up to 1000 messages per operation
msgs | the message list of be imported |
void com.hyphenate.chat.EMChatManager.loadAllConversations | ( | ) |
load all conversatons from local database
void com.hyphenate.chat.EMChatManager.markAllConversationsAsRead | ( | ) |
mark all messages as read
void com.hyphenate.chat.EMChatManager.recallMessage | ( | EMMessage | message | ) | throws HyphenateException |
Recall the sent message
message | message |
void com.hyphenate.chat.EMChatManager.removeConversationListener | ( | EMConversationListener | listener | ) |
remove the conversation listener
listener | the conversation listener set before |
void com.hyphenate.chat.EMChatManager.removeMessageListener | ( | EMMessageListener | listener | ) |
remove the message listener
listener | the message listener set before |
void com.hyphenate.chat.EMChatManager.saveMessage | ( | EMMessage | message | ) |
save the message to memory and local database CMD type message to will stored in database
message |
List< EMMessage > com.hyphenate.chat.EMChatManager.searchMsgFromDB | ( | EMMessage.Type | type, |
long | timeStamp, | ||
int | maxCount, | ||
String | from, | ||
EMConversation.EMSearchDirection | direction | ||
) |
search message from database according the parameter Note: Cautious about memory usage when the maxCount is large
type | message type, TXT、VOICE、IMAGE etc. |
timeStamp | the timestamp for search |
maxCount | the max number of message to search |
from | who the message from, used to search in group |
List< EMMessage > com.hyphenate.chat.EMChatManager.searchMsgFromDB | ( | String | keywords, |
long | timeStamp, | ||
int | maxCount, | ||
String | from, | ||
EMConversation.EMSearchDirection | direction | ||
) |
search message from database based the parameters Note: Cautious about memory usage when the maxCount is large
keywords | the keywords in message. |
timeStamp | the timestamp for search |
maxCount | the max number of message to search |
from | who the message from, used to search in group |
void com.hyphenate.chat.EMChatManager.sendMessage | ( | final EMMessage | msg | ) |
send message asynchronously and you can set this message status callback through EMMessage.setMessageStatusCallback
msg |
void com.hyphenate.chat.EMChatManager.setMessageListened | ( | EMMessage | message | ) |
set message to listened, used for voice message
void com.hyphenate.chat.EMChatManager.setVoiceMessageListened | ( | EMMessage | message | ) |
set message to listened, used for voice message
boolean com.hyphenate.chat.EMChatManager.updateMessage | ( | EMMessage | message | ) |
update the message
message |
boolean com.hyphenate.chat.EMChatManager.updateParticipant | ( | String | from, |
String | changeTo | ||
) |
update database records, change username 'from' to 'changeTo', take effect on message table, conversation table, contacts, blacklist table note: this operation does not update data stored in memory cache.
from | |
changeTo |