hyphenate_SDK3.0  3.5.6
hyphenatejavaIMSDK
Public Member Functions | Protected Member Functions | List of all members
com.hyphenate.chat.EMChatManager Class Reference
Collaboration diagram for com.hyphenate.chat.EMChatManager:
Collaboration graph
[legend]

Public Member Functions

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< EMConversationgetConversationsByType (EMConversationType type)
 
void downloadFile (final String remoteUrl, final String localFilePath, final Map< String, String > headers, final EMCallBack callback)
 
Map< String, EMConversationgetAllConversations ()
 
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< EMMessagefetchHistoryMessages (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 Member Functions

 EMChatManager (EMClient client, EMAChatManager manager)
 

Detailed Description

send a message EMMessage msg = EMMessage; EMClient.getInstance().chatManager().sendMessage(msg);

Member Function Documentation

void com.hyphenate.chat.EMChatManager.ackMessageRead ( String  to,
String  messageId 
) throws HyphenateException

send read ack to server

Parameters
tothe recipient id
messageIdmessage id
Exceptions
HyphenateException
void com.hyphenate.chat.EMChatManager.addConversationListener ( EMConversationListener  listener)

add conversation listener

See also
EMConversationListener refresh the conversation list when receiving the conversation refresh event
Parameters
listenerthe conversation listener
void com.hyphenate.chat.EMChatManager.addMessageListener ( EMMessageListener  listener)

add message listener

See also
EMMessageListener
Parameters
listenerthe message listener which is used to monitor the incoming messages
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.

Parameters
conversationIdthe conversation id which select to fetch roam message.
typethe conversation type which select to fetch roam message.
pageSizethe page size.
startMsgIdthe start search roam message, if empty start from the server lastest message.
callBackserver 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

Parameters
usernameuser id or group id
deleteMessageswhether delete messages
Returns
return true if delete successfully
void com.hyphenate.chat.EMChatManager.downloadAttachment ( final EMMessage  msg)

download the message attachement

Parameters
msgmessage 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.

Parameters
remoteUrlthe remote file url
localFilePaththe local file path
headersHttp Request Headers
callbackEMCallBack
void com.hyphenate.chat.EMChatManager.downloadThumbnail ( final EMMessage  msg)

download the thumbnail if not downloaded before

Parameters
msgthe message to be downloaded
EMCursorResult<EMMessage> com.hyphenate.chat.EMChatManager.fetchHistoryMessages ( String  conversationId,
EMConversationType  type,
int  pageSize,
String  startMsgId 
) throws HyphenateException

fetch conversation roam messages from server.

Parameters
conversationIdthe conversation id which select to fetch roam message.
typethe conversation type which select to fetch roam message.
pageSizethe page size.
startMsgIdthe start search roam message, if empty start from the server lastest message.
Returns
server return messages and cursor for next fetch action.
Map<String, EMConversation> com.hyphenate.chat.EMChatManager.getAllConversations ( )

get all conversations in the cache

Returns
conversations which is a map with key&#45;&#62;conversation id : value&#45;&#62;EMConversation
EMConversation com.hyphenate.chat.EMChatManager.getConversation ( String  id)

get conversation by id

Parameters
iduser id, group id or chatroom id
Returns
EMConversation the existing conversation found by conversation, null if not found
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

Parameters
iduser id, group id or chatroom id
type
See also
EMConversationType the conversation type
Returns
EMConversation the conversation found according to the id and type, create a empty conversation if not found
EMConversation com.hyphenate.chat.EMChatManager.getConversation ( String  username,
EMConversationType  type,
boolean  createIfNotExists 
)

get conversation by conversation id and conversation type

Parameters
usernameuser id, group id or chatroom id
type
See also
EMConversationType the conversation type
Parameters
createIfNotExistscreate conversation if not exists
Returns
List<EMConversation> com.hyphenate.chat.EMChatManager.getConversationsByType ( EMConversationType  type)

get list of conversations by conversation type

Parameters
typeconveration type
Returns
list of conversation in specified type
EMMessage com.hyphenate.chat.EMChatManager.getMessage ( String  messageId)

get message through message id

Parameters
messageIdmessage id
Returns
int com.hyphenate.chat.EMChatManager.getUnreadMessageCount ( )

get unread message count

Returns
int com.hyphenate.chat.EMChatManager.getUnreadMsgsCount ( )

get unread message count

Deprecated:
use EMChatManager#getUnreadMessageCount() instead
Returns
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

Parameters
msgsthe 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

Parameters
messagemessage
Returns
void com.hyphenate.chat.EMChatManager.removeConversationListener ( EMConversationListener  listener)

remove the conversation listener

Parameters
listenerthe conversation listener set before
void com.hyphenate.chat.EMChatManager.removeMessageListener ( EMMessageListener  listener)

remove the message listener

Parameters
listenerthe 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

Parameters
message
void com.hyphenate.chat.EMChatManager.sendMessage ( final EMMessage  msg)

send message asynchronously and you can set this message status callback through EMMessage.setMessageStatusCallback

Parameters
msg
void com.hyphenate.chat.EMChatManager.setMessageListened ( EMMessage  message)

set message to listened, used for voice message

Deprecated:
use EMChatManager#setVoiceMessageListened(EMMessage) instead
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

Parameters
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.

Parameters
from
changeTo
Returns
operation result, if any update operations on those tables failed, result is false

The documentation for this class was generated from the following file: