hyphenate_SDK4.0 4.8.0
hyphenate java IM SDK
Public Member Functions | Protected Member Functions | List of all members
com.hyphenate.chat.EMChatManager Class Reference

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 asyncRecallMessage (final EMMessage message, final EMCallBack callback)
 
void recallMessage (EMMessage message, String ext) throws HyphenateException
 
void asyncRecallMessage (final EMMessage message, String ext, 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)
 
EMConversation getConversation (String username, EMConversationType type, boolean createIfNotExists, boolean isChatThread)
 
boolean markAllConversationsAsRead ()
 
int getUnreadMessageCount ()
 
void saveMessage (EMMessage message)
 
boolean updateMessage (EMMessage message)
 
void asyncModifyMessage (String messageId, EMMessageBody messageBodyModified, final EMValueCallBack< EMMessage > callBack)
 
void downloadAttachment (final EMMessage msg)
 
void downloadThumbnail (final EMMessage msg)
 
void downloadAndParseCombineMessage (EMMessage message, EMValueCallBack< List< EMMessage > > callback)
 
synchronized void importMessages (List< EMMessage > msgs)
 
List< EMConversationgetConversationsByType (EMConversationType type)
 
Map< String, EMConversationgetAllConversations ()
 
List< EMConversationgetAllConversationsBySort ()
 
void asyncFilterConversationsFromDB (EMCustomConversationFilter filter, boolean cleanConversationsCache, EMValueCallBack< List< EMConversation > > callBack)
 
void cleanConversationsMemoryCache ()
 
Map< String, EMConversationfetchConversationsFromServer () throws HyphenateException
 
void asyncFetchConversationsFromServer (final EMValueCallBack< Map< String, EMConversation > > callBack)
 
void asyncFetchConversationsFromServer (int pageNum, int pageSize, final EMValueCallBack< Map< String, EMConversation > > callBack)
 
void asyncFetchPinnedConversationsFromServer (final int limit, final String cursor, final EMValueCallBack< EMCursorResult< EMConversation > > callback)
 
void asyncFetchConversationsFromServer (final int limit, final String cursor, final EMValueCallBack< EMCursorResult< EMConversation > > callback)
 
void asyncPinConversation (final String conversationId, boolean isPinned, final EMCallBack callback)
 
void loadAllConversations ()
 
boolean deleteConversation (String username, boolean deleteMessages)
 
void deleteConversationFromServer (String username, EMConversationType type, boolean isDeleteServerMessages, EMCallBack deleteCallBack)
 
void addMessageListener (EMMessageListener listener)
 
void removeMessageListener (EMMessageListener listener)
 
void addConversationListener (EMConversationListener listener)
 
void removeConversationListener (EMConversationListener listener)
 
void setVoiceMessageListened (EMMessage message)
 
boolean updateParticipant (String from, String changeTo)
 
EMCursorResult< EMGroupReadAckfetchGroupReadAcks (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< EMMessagefetchHistoryMessages (String conversationId, EMConversationType type, int pageSize, String startMsgId) throws HyphenateException
 
EMCursorResult< EMMessagefetchHistoryMessages (String conversationId, EMConversationType type, int pageSize, String startMsgId, EMConversation.EMSearchDirection direction) throws HyphenateException
 
void asyncFetchHistoryMessage (final String conversationId, final EMConversationType type, final int pageSize, final String startMsgId, final EMValueCallBack< EMCursorResult< EMMessage > > callBack)
 
void asyncFetchHistoryMessage (final String conversationId, final EMConversationType type, final int pageSize, final String startMsgId, final EMConversation.EMSearchDirection direction, final EMValueCallBack< EMCursorResult< EMMessage > > callBack)
 
void asyncFetchHistoryMessages (String conversationId, EMConversationType type, int pageSize, String cursor, EMFetchMessageOption option, final EMValueCallBack< EMCursorResult< EMMessage > > callBack)
 
List< EMMessagesearchMsgFromDB (@NonNull Type type, long timeStamp, int maxCount, String from, EMConversation.EMSearchDirection direction)
 
List< EMMessagesearchMsgFromDB (Set< Type > types, long timeStamp, int maxCount, String from, EMConversation.EMSearchDirection direction)
 
List< EMMessagesearchMsgFromDB (String keywords, long timeStamp, int maxCount, String from, EMConversation.EMSearchDirection direction)
 
List< EMMessagesearchMsgFromDB (String keywords, long timeStamp, int maxCount, String from, EMConversation.EMSearchDirection direction, EMConversation.EMMessageSearchScope searchScope)
 
void deleteMessagesBeforeTimestamp (long timeStamp, EMCallBack callback)
 
void asyncReportMessage (String msgId, String tag, String reportReason, EMCallBack callback)
 
void reportMessage (String msgId, String tag, String reportReason) throws HyphenateException
 
void fetchSupportLanguages (EMValueCallBack< List< EMLanguage > > callback)
 
void translateMessage (EMMessage message, List< String > languages, EMValueCallBack< EMMessage > callback)
 
void addReaction (final String messageId, final String reaction) throws HyphenateException
 
void asyncAddReaction (final String messageId, final String reaction, final EMCallBack callback)
 
void removeReaction (final String messageId, final String reaction) throws HyphenateException
 
void asyncRemoveReaction (final String messageId, final String reaction, final EMCallBack callback)
 
Map< String, List< EMMessageReaction > > getReactionList (final List< String > messageIdList, final EMMessage.ChatType chatType, final String groupId) throws HyphenateException
 
void asyncGetReactionList (final List< String > messageIdList, final EMMessage.ChatType chatType, final String groupId, final EMValueCallBack< Map< String, List< EMMessageReaction > > > callback)
 
EMCursorResult< EMMessageReactiongetReactionDetail (final String messageId, final String reaction, final String cursor, final int pageSize) throws HyphenateException
 
void asyncGetReactionDetail (final String messageId, final String reaction, final String cursor, final int pageSize, final EMValueCallBack< EMCursorResult< EMMessageReaction > > callback)
 
void asyncAddConversationMark (@NonNull List< String > conversationIds, @NonNull EMMarkType mark, EMCallBack callback)
 
void asyncRemoveConversationMark (@NonNull List< String > conversationIds, @NonNull EMMarkType mark, EMCallBack callback)
 
void asyncGetConversationsFromServerWithCursor (@NonNull String cursor, @NonNull EMConversationFilter filter, EMValueCallBack< EMCursorResult< EMConversation > > callback)
 
void asyncDeleteAllMsgsAndConversations (boolean clearSeverData, EMCallBack deleteCallBack)
 
void asyncPinMessage (@NonNull String messageId, EMCallBack callBack)
 
void asyncUnPinMessage (@NonNull String messageId, EMCallBack callBack)
 
void asyncGetPinnedMessagesFromServer (@NonNull String conversationId, EMValueCallBack< List< EMMessage > > callBack)
 

Protected Member Functions

void removeMessagesFromServer (String conversationId, EMConversationType type, List< String > msgIdList, EMCallBack callBack)
 
void removeMessagesFromServer (String conversationId, EMConversationType type, long beforeTimeStamp, EMCallBack callBack)
 

Detailed Description

The chat manager class, responsible for sending and receiving messages, managing conversations (including loading and deleting conversations), and downloading attachments.

The sample code for sending a text message is as follows:

EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername);
EMClient.getInstance().chatManager().sendMessage(message);

Member Function Documentation

◆ ackConversationRead()

void com.hyphenate.chat.EMChatManager.ackConversationRead ( String  conversationId) throws HyphenateException

Sends the conversation read receipt to the server.

This method is only for one-to-one chat conversations.

This method will inform the sever to set the unread message count of the conversation to 0. The message sender will receive the EMConversationListener#onConversationRead(String, String) callback. The message recipient that has logged in to multiple devices, will also receive the callback.

If you want to send a read receipt for a group message, call ackGroupMessageRead(String, String, String).

Parameters
conversationIdThe conversation ID.
Exceptions
HyphenateExceptionThe possible exceptions are as follows: EMError#USER_NOT_LOGIN, EMError#SERVER_NOT_REACHABLE, and EMError#MESSAGE_INVALID. See EMError.

◆ ackGroupMessageRead()

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

Sends the read receipt for a group message to the server.

Note

You can only call this method after setting EMOptions#setRequireAck(boolean) and EMMessage#setIsNeedGroupAck(boolean) to true.

To send the read recipient for a one-to-one chat message to the server, call ackMessageRead(String, String).

To send the conversation read receipt to the server, call ackConversationRead(String).

Parameters
toThe conversation ID.
messageIdThe message ID.
extThe extension information, which is a custom keyword that specifies a custom action or command.
Exceptions
HyphenateExceptionA description of the exception, see EMError.

◆ ackMessageRead()

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

Sends the read receipt for a message to the server.

Note

This method applies to one-to-one chats only.

This method only takes effect if you set EMOptions#setRequireAck(boolean) as true.

To send the read receipt for a group message, call ackGroupMessageRead(String, String, String).

We recommend that you call ackConversationRead(String) when opening the chat page, and call this method in other cases to reduce the number of method calls.

Parameters
toThe recipient of the read receipt.
messageIdThe message ID.
Exceptions
HyphenateExceptionA description of the exception, see EMError.

◆ addConversationListener()

void com.hyphenate.chat.EMChatManager.addConversationListener ( EMConversationListener  listener)

Adds the conversation listener.

After a conversation listener is added, you can listen for conversation changes and conversation read receipts.

You can call the removeConversationListener(EMConversationListener) method to remove the conversation listener when it is not required.

Parameters
listenerThe conversation listener to add. See EMConversationListener.

◆ addMessageListener()

void com.hyphenate.chat.EMChatManager.addMessageListener ( EMMessageListener  listener)

Adds the message listener.

After a message listener is added, you can listen for new messages when they arrive.

You can call removeMessageListener(EMMessageListener) to remove the message listener when it is not required.

Parameters
listenerThe message listener to add. See EMMessageListener.

◆ addReaction()

void com.hyphenate.chat.EMChatManager.addReaction ( final String  messageId,
final String  reaction 
) throws HyphenateException

Adds a Reaction.

This is a synchronous method.

Parameters
messageIdThe message ID.
reactionThe Reaction content.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ asyncAddConversationMark()

void com.hyphenate.chat.EMChatManager.asyncAddConversationMark ( @NonNull List< String >  conversationIds,
@NonNull EMMarkType  mark,
EMCallBack  callback 
)

Marks conversations.

This method marks conversations both locally and on the server.

Parameters
conversationIdsThe list of conversation IDs.
markThe mark to add for the conversations.
callbackThe completion callback, which contains the description of the cause to the failure.

◆ asyncAddReaction()

void com.hyphenate.chat.EMChatManager.asyncAddReaction ( final String  messageId,
final String  reaction,
final EMCallBack  callback 
)

Adds a Reaction.

This is an asynchronous method.

Parameters
messageIdThe message ID.
reactionThe message Reaction to add.
callbackThe result callback which contains the error information if the method fails. See EMCallBack.

◆ asyncDeleteAllMsgsAndConversations()

void com.hyphenate.chat.EMChatManager.asyncDeleteAllMsgsAndConversations ( boolean  clearSeverData,
EMCallBack  deleteCallBack 
)

Clears all conversations and all messages in them.

This is an asynchronous method.

Parameters
clearSeverDataWhether to clear all conversations and all messages in them on the server.
  • true:Yes. All conversations and all messages in them will be cleared on the server side. The current user cannot retrieve messages and conversations from the server, while this has no impact on other users.
  • (Default) false:No. All local conversations and all messages in them will be cleared, while those on the server remain.
    Parameters
    deleteCallBackThe completion callback, which contains the description of the cause to the failure.

◆ asyncFetchConversationsFromServer() [1/3]

void com.hyphenate.chat.EMChatManager.asyncFetchConversationsFromServer ( final EMValueCallBack< Map< String, EMConversation > >  callBack)

Gets the conversation list from the server.

This is an asynchronous method.

Returns
The conversation list of the current user.
Deprecated:
Deprecated. Use asyncFetchConversationsFromServer(int, String, EMValueCallBack) instead.

◆ asyncFetchConversationsFromServer() [2/3]

void com.hyphenate.chat.EMChatManager.asyncFetchConversationsFromServer ( final int  limit,
final String  cursor,
final EMValueCallBack< EMCursorResult< EMConversation > >  callback 
)

Gets the list of conversations from the server with pagination.

The SDK retrieves the list of conversations in the reverse chronological order of their active time (generally the timestamp of the last message).

If there is no message in the conversation, the SDK retrieves the list of conversations in the reverse chronological order of their creation time.

Parameters
limitThe number of conversations that you expect to get on each page. The value range is [1,50].
cursorThe position from which to start to get data. If you pass in null or an empty string (""), the SDK retrieves conversations from the latest active one.
callbackThe query result EMCursorResult, including the cursor for getting data next time and the conversation list. For the last page, the return value of cursor is an empty string.

◆ asyncFetchConversationsFromServer() [3/3]

void com.hyphenate.chat.EMChatManager.asyncFetchConversationsFromServer ( int  pageNum,
int  pageSize,
final EMValueCallBack< Map< String, EMConversation > >  callBack 
)

Gets the conversation list from the server with pagination.

This is an asynchronous method.

Parameters
pageNumThe current page number, starting from 1.
pageSizeThe number of conversations to get on each page. The value range is [1,20].
Returns
The conversation list of the current user.
Deprecated:
Deprecated. Use asyncFetchConversationsFromServer(int, String, EMValueCallBack) instead.

◆ asyncFetchGroupReadAcks()

void com.hyphenate.chat.EMChatManager.asyncFetchGroupReadAcks ( final String  msgId,
final int  pageSize,
final String  startAckId,
final EMValueCallBack< EMCursorResult< EMGroupReadAck > >  callBack 
)

Uses the pagination to get read receipts for the group message from the server.

To send a read receipt for a group message, you can call ackGroupMessageRead(String, String, String).

This is an asynchronous method.

Parameters
msgIdThe message ID.
pageSizeThe number of read receipts for the group message that you expect to get on each page. The value range is [1,50].
startAckIdThe starting read receipt ID for query. After this parameter is set, the SDK retrieves read receipts, from the specified one, in the reverse chronological order of when the server receives them. If this parameter is set as null or an empty string, the SDK retrieves read receipts, from the latest one, in the reverse chronological order of when the server receives them.
callBackThe result callback:

◆ asyncFetchHistoryMessage() [1/2]

void com.hyphenate.chat.EMChatManager.asyncFetchHistoryMessage ( final String  conversationId,
final EMConversationType  type,
final int  pageSize,
final String  startMsgId,
final EMConversation.EMSearchDirection  direction,
final EMValueCallBack< EMCursorResult< EMMessage > >  callBack 
)

Uses the pagination to get the messages of all types in the conversation from the server according to the message search direction.

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
  • One-to-one chat: The ID of the peer user;
  • Group chat: The group ID.
typeThe conversation type. See EMConversationType.
pageSizeThe number of messages that you expect to get on each page. The value range is [1,50].
startMsgIdThe starting message ID for query. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If this parameter is set as "null" or an empty string, the SDK retrieves messages according to the message search direction while ignoring this parameter.
  • If direction is set as UP, the SDK retrieves messages, starting from the latest one, in the reverse chronological order of when the server receives them.
  • If direction is set as DOWN, the SDK retrieves messages, starting from the oldest one, in the chronological order of when the server receives them.
directionThe message search direction. See EMConversation.EMSearchDirection.
  • (Default) UP: The SDK retrieves messages in the descending order of the timestamp included in them.
    • DOWN: The SDK retrieves messages in the ascending order of the timestamp included in them.
callBackThe result callback:
Deprecated:
Deprecated. Use asyncFetchHistoryMessages(String, EMConversationType, int, String, EMFetchMessageOption, EMValueCallBack) instead.

◆ asyncFetchHistoryMessage() [2/2]

void com.hyphenate.chat.EMChatManager.asyncFetchHistoryMessage ( final String  conversationId,
final EMConversationType  type,
final int  pageSize,
final String  startMsgId,
final EMValueCallBack< EMCursorResult< EMMessage > >  callBack 
)

Uses the pagination to get the messages of all types in the conversation from the server.

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
  • One-to-one chat: The ID of the peer user;
  • Group chat: The group ID.
typeThe conversation type. See EMConversationType.
pageSizeThe number of messages that you expect to get on each page. The value range is [1,50].
startMsgIdThe starting message ID for query. After this parameter is set, the SDK retrieves messages, starting from the specified one, in the reverse chronological order of when the server receives them. If this parameter is set as "null" or an empty string, the SDK retrieves messages, starting from the latest one, in the reverse chronological order of when the server receives them.
callBackThe result callback:
Deprecated:
Deprecated. Use asyncFetchHistoryMessages(String, EMConversationType, int, String, EMFetchMessageOption, EMValueCallBack) instead.

◆ asyncFetchHistoryMessages()

void com.hyphenate.chat.EMChatManager.asyncFetchHistoryMessages ( String  conversationId,
EMConversationType  type,
int  pageSize,
String  cursor,
EMFetchMessageOption  option,
final EMValueCallBack< EMCursorResult< EMMessage > >  callBack 
)

/**

Uses the pagination to get the messages in the conversation from the server according to the message pulling parameter configuration class (EMFetchMessageOption).

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
  • One-to-one chat: The ID of the peer user.
  • Group chat: The group ID.
  • Chat room: The chat room ID.
typeThe conversation type. See EMConversationType.
pageSizeThe number of messages you expect to get on each page. The value range is [1,50].
cursorThe cursor position from which to start querying data.
optionThe parameter configuration class for querying historical messages. See EMFetchMessageOption.
Returns
The list of retrieved messages and the cursor for the next query.
Parameters
callBackThe result callback:

◆ asyncFetchPinnedConversationsFromServer()

void com.hyphenate.chat.EMChatManager.asyncFetchPinnedConversationsFromServer ( final int  limit,
final String  cursor,
final EMValueCallBack< EMCursorResult< EMConversation > >  callback 
)

Get the list of pinned conversations from the server with pagination.

The SDK returns pinned conversations in the reverse chronological order of their pinning.

Parameters
limitThe number of conversations that you expect to get on each page. The value range is [1,50].
cursorThe position from which to start getting data. If you pass in null or an empty string (""), the SDK retrieves the pinned conversations from the latest pinned one.
callbackThe query result EMCursorResult, including the cursor for getting data next time and the list of pinned conversations. For the last page, the return value of cursor is an empty string.

◆ asyncFilterConversationsFromDB()

void com.hyphenate.chat.EMChatManager.asyncFilterConversationsFromDB ( EMCustomConversationFilter  filter,
boolean  cleanConversationsCache,
EMValueCallBack< List< EMConversation > >  callBack 
)

Gets local conversations by the custom conversation filter.

The SDK loads conversations from the local database by the specified filter conditions.

This is an asynchronous method.

Parameters
filterThe filter. See EMCustomConversationFilter. If you want to get all conversations, pass in null.
cleanConversationsCacheWhether to clear the cached conversations in memory:
  • true: Yes.
  • false: No.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) and returns the list of filtered conversation.

◆ asyncGetConversationsFromServerWithCursor()

void com.hyphenate.chat.EMChatManager.asyncGetConversationsFromServerWithCursor ( @NonNull String  cursor,
@NonNull EMConversationFilter  filter,
EMValueCallBack< EMCursorResult< EMConversation > >  callback 
)

Gets the conversations from the server with pagination according to the conversation filter class.

Parameters
cursorThe position from which to start getting data. If you pass in an empty string, the SDK retrieves conversations from the latest marked one.
filterThe conversation filter options: conversation mark and the number of conversations to retrieve on each page.
callbackThe completion callback, which contains the conversation list and the cursor for the next query. When the cursor is empty, all data is already retrieved.

◆ asyncGetPinnedMessagesFromServer()

void com.hyphenate.chat.EMChatManager.asyncGetPinnedMessagesFromServer ( @NonNull String  conversationId,
EMValueCallBack< List< EMMessage > >  callBack 
)

Gets the list of pinned messages from the server.

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
callBackThe completion callback. If the call succeeds, the list of pined messages in the conversation are returned. If the call fails, the cause of the failure is returned.

◆ asyncGetReactionDetail()

void com.hyphenate.chat.EMChatManager.asyncGetReactionDetail ( final String  messageId,
final String  reaction,
final String  cursor,
final int  pageSize,
final EMValueCallBack< EMCursorResult< EMMessageReaction > >  callback 
)

Gets the Reaction details.

This is an asynchronous method.

Parameters
messageIdThe message ID.
reactionThe Reaction content.
cursorThe cursor position from which to start querying data.
pageSizeThe number of Reactions you expect to get on each page.
callbackThe query result EMCursorResult, which contains the cursor for the next query and EMMessageReaction list (only the first data entry is used).

◆ asyncGetReactionList()

void com.hyphenate.chat.EMChatManager.asyncGetReactionList ( final List< String >  messageIdList,
final EMMessage.ChatType  chatType,
final String  groupId,
final EMValueCallBack< Map< String, List< EMMessageReaction > > >  callback 
)

Gets the list of Reactions.

This is an asynchronous method.

Parameters
messageIdListThe message ID.
chatTypeThe conversation type. Only one-to-one chats (EMMessage.ChatType#Chat and group chats (EMMessage.ChatType#GroupChat) are allowed.
groupIdThe group ID, which is valid only for group chats.
callbackThe Reaction list under the specified message ID. The UserList of EMMessageReaction indicates the summary data, which only contains the information of the first three users.

◆ asyncModifyMessage()

void com.hyphenate.chat.EMChatManager.asyncModifyMessage ( String  messageId,
EMMessageBody  messageBodyModified,
final EMValueCallBack< EMMessage callBack 
)

Modifies a message.

After this method is called to modify a message, both the local message and the message on the server are modified.

This method can only modify a text message in one-to-one chats or group chats, but not in chat rooms.

Upon a message modification, the callback EMMessageListener#onMessageContentChanged(EMMessage, String, long) will be received by the message recipient(s) and in multi-device login scenarios.

Parameters
messageIdThe ID of the message to modify.
messageBodyModifiedThe modified message body.
callBackThe message modification callback. A object of the EMValueCallBack class. See EMValueCallBack,contains the message modified.

◆ asyncPinConversation()

void com.hyphenate.chat.EMChatManager.asyncPinConversation ( final String  conversationId,
boolean  isPinned,
final EMCallBack  callback 
)

Sets whether to pin a conversation.

Parameters
conversationIdThe conversation ID.
isPinnedWhether to pin the conversation:
  • true:Yes.
  • false: No. The conversation is unpinned.
    Parameters
    callbackThe callback for setting whether to pin the conversation.

◆ asyncPinMessage()

void com.hyphenate.chat.EMChatManager.asyncPinMessage ( @NonNull String  messageId,
EMCallBack  callBack 
)

Pins a message.

This is an asynchronous method.

Parameters
messageIdThe ID of the message to be pinned.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ asyncRecallMessage() [1/2]

void com.hyphenate.chat.EMChatManager.asyncRecallMessage ( final EMMessage  message,
final EMCallBack  callback 
)

Recalls the sent message.

This is an asynchronous method.

Parameters
messageThe message object.
callbackA object of the EMCallBack class. See EMCallBack.

◆ asyncRecallMessage() [2/2]

void com.hyphenate.chat.EMChatManager.asyncRecallMessage ( final EMMessage  message,
String  ext,
final EMCallBack  callback 
)

Recalls the sent message.

This is an asynchronous method.

Parameters
messageThe message object.
extThe extended information.
callbackA object of the EMCallBack class. See EMCallBack.

◆ asyncRemoveConversationMark()

void com.hyphenate.chat.EMChatManager.asyncRemoveConversationMark ( @NonNull List< String >  conversationIds,
@NonNull EMMarkType  mark,
EMCallBack  callback 
)

Unmarks conversations.

This method unmarks conversations both locally and on the server.

Parameters
conversationIdsThe list of conversation IDs.
markThe conversation mark to remove.
callbackThe completion callback, which contains the description of the cause to the failure.

◆ asyncRemoveReaction()

void com.hyphenate.chat.EMChatManager.asyncRemoveReaction ( final String  messageId,
final String  reaction,
final EMCallBack  callback 
)

Deletes a Reaction.

This is an asynchronous method.

Parameters
messageIdThe message ID.
reactionThe Reaction to delete.
callbackThe result callback which contains the error information if the method fails. See EMCallBack.

◆ asyncReportMessage()

void com.hyphenate.chat.EMChatManager.asyncReportMessage ( String  msgId,
String  tag,
String  reportReason,
EMCallBack  callback 
)

Reports an inappropriate message.

This is an asynchronous method.

Parameters
msgIdThe ID of the message to report.
tagThe tag of the inappropriate message. You need to type a custom tag, like porn or ad.
reportReasonThe reporting reason. You need to type a specific reason.
callbackThe result callback. See EMCallBack.

◆ asyncUnPinMessage()

void com.hyphenate.chat.EMChatManager.asyncUnPinMessage ( @NonNull String  messageId,
EMCallBack  callBack 
)

Unpins a message.

This is an asynchronous method.

Parameters
messageIdThe ID of the message to be unpinned.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ cleanConversationsMemoryCache()

void com.hyphenate.chat.EMChatManager.cleanConversationsMemoryCache ( )

Clears all conversations in memory to release the memory.

Note: After releasing the memory, you cannot get any conversations by calling getAllConversations() or getAllConversationsBySort(). Also, if you call getUnreadMessageCount() in this case, the returned number of unread messages is 0.

If you want to retrieve all conversations and the number of unread messages, you need to call loadAllConversations() or asyncFilterConversationsFromDB(EMCustomConversationFilter, boolean, EMValueCallBack) to reload the conversations from the database into memory first.

◆ deleteConversation()

boolean com.hyphenate.chat.EMChatManager.deleteConversation ( String  username,
boolean  deleteMessages 
)

Deletes a conversation and its local messages from the local database.

Parameters
usernameThe conversation ID.
deleteMessagesWhether to delete the historical messages with the conversation.
  • true: Yes.
  • false: No.
Returns
Whether the conversation is successfully deleted.
  • true: Yes.
  • false: No.

◆ deleteConversationFromServer()

void com.hyphenate.chat.EMChatManager.deleteConversationFromServer ( String  username,
EMConversationType  type,
boolean  isDeleteServerMessages,
EMCallBack  deleteCallBack 
)

Deletes the specified conversation and its historical messages from the server.

This is an asynchronous method.

Parameters
usernameThe conversation ID.
typeThe conversation type. See EMConversationType.
isDeleteServerMessagesWhether to delete the historical messages with the conversation.
  • true: Yes
  • false: No
deleteCallBackThe callback for the deletion of the conversation and its historical messages.
  • true: Success;
  • false: Failure.

◆ deleteMessagesBeforeTimestamp()

void com.hyphenate.chat.EMChatManager.deleteMessagesBeforeTimestamp ( long  timeStamp,
EMCallBack  callback 
)

Deletes local historical messages with a Unix timestamp before a specified one.

Parameters
timeStampThe starting Unix timestamp in the message for query. This unit is millisecond.
callbackThe result callback. See EMCallBack.

◆ downloadAndParseCombineMessage()

void com.hyphenate.chat.EMChatManager.downloadAndParseCombineMessage ( EMMessage  message,
EMValueCallBack< List< EMMessage > >  callback 
)

Downloads and parses the attachment of the combined message.

For a combined message, this method downloads and parses the attachment and returns the message list at the first call; for subsequent calls, there are two cases: 1.If the attachment already exits, this method directly parses it and returns the message list. 2.If the attachment does not exist, this method downloads it before parsing it and returning the message list.

Parameters
messageThe combined message to download and parse.
callbackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) and returns the parsed message list; If this call fails, calls EMValueCallBack#onError(int, String).

◆ downloadAttachment()

void com.hyphenate.chat.EMChatManager.downloadAttachment ( final EMMessage  msg)

Downloads the message attachment.

You can also call this method if the attachment fails to be downloaded automatically.

Parameters
msgThe ID of the message with the attachment to be downloaded.

◆ downloadThumbnail()

void com.hyphenate.chat.EMChatManager.downloadThumbnail ( final EMMessage  msg)

Downloads the message thumbnail.

Parameters
msgThe message with the thumbnail to be downloaded. Only the image messages and video messages have a thumbnail.

◆ fetchConversationsFromServer()

Map< String, EMConversation > com.hyphenate.chat.EMChatManager.fetchConversationsFromServer ( ) throws HyphenateException

Gets the conversation list from the server.

You can pull 10 conversations within 7 days by default (each conversation contains the latest historical message).

This is a synchronous method and blocks the current thread.

Returns
The conversation list of the current user.
Deprecated:
Deprecated. Use asyncFetchConversationsFromServer(int, String, EMValueCallBack) instead.

◆ fetchGroupReadAcks()

EMCursorResult< EMGroupReadAck > com.hyphenate.chat.EMChatManager.fetchGroupReadAcks ( String  msgId,
int  pageSize,
String  startAckId 
) throws HyphenateException

Uses the pagination to get read receipts for a group message from the server.

To send a read receipt for a group message, you can call ackGroupMessageRead(String, String, String).

This is a synchronous method and blocks the current thread.

Parameters
msgIdThe message ID.
pageSizeThe number of read receipts for the group message that you expect to get on each page. The value range is [1,50].
startAckIdThe starting read receipt ID for query. After this parameter is set, the SDK retrieves read receipts, from the specified one, in the reverse chronological order of when the server receives them. If this parameter is set as null or an empty string, the SDK retrieves read receipts, from the latest one, in the reverse chronological order of when the server receives them.
Returns
The list of retrieved read receipts (excluding the one with the starting ID) and the cursor for the next query.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ fetchHistoryMessages() [1/2]

EMCursorResult< EMMessage > com.hyphenate.chat.EMChatManager.fetchHistoryMessages ( String  conversationId,
EMConversationType  type,
int  pageSize,
String  startMsgId 
) throws HyphenateException

Uses the pagination to get the messages of all types in the conversation from the server.

This is a synchronous method and blocks the current thread.

Parameters
conversationIdThe conversation ID.
  • One-to-one chat: The ID of the peer user;
  • Group chat: The group ID.
typeThe conversation type. See EMConversationType.
pageSizeThe number of messages that you expect to get on each page. The value range is [1,50].
startMsgIdThe starting message ID for query. After this parameter is set, the SDK retrieves messages, from the specified one, in the reverse chronological order of when the server receives them. If this parameter is set as null or an empty string, the SDK retrieves messages, starting from the latest one, in the reverse chronological order of when the server receives them.
Returns
The list of retrieved messages (excluding the one with the starting message ID) and the cursor for the next query.
Exceptions
HyphenateExceptionA description of the exception. See EMError.
Deprecated:
Deprecated. Use asyncFetchHistoryMessages(String, EMConversationType, int, String, EMFetchMessageOption, EMValueCallBack) instead.

◆ fetchHistoryMessages() [2/2]

EMCursorResult< EMMessage > com.hyphenate.chat.EMChatManager.fetchHistoryMessages ( String  conversationId,
EMConversationType  type,
int  pageSize,
String  startMsgId,
EMConversation.EMSearchDirection  direction 
) throws HyphenateException

Uses the pagination to get the messages of all types in the conversation from the server according to the message search direction.

This is a synchronous method and blocks the current thread.

Parameters
conversationIdThe conversation ID.
  • One-to-one chat: The ID of the peer user;
  • Group chat: The group ID.
typeThe conversation type. See EMConversationType.
pageSizeThe number of messages you expect to get on each page. The value range is [1,50].
startMsgIdThe starting message ID for query. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If this parameter is set as "null" or an empty string, the SDK retrieves messages according to the message search direction while ignoring this parameter.
  • If direction is set as UP, the SDK retrieves messages, starting from the latest one, in the reverse chronological order of when the server receives them.
  • If direction is set as DOWN, the SDK retrieves messages, starting from the oldest one, in the chronological order of the time the server receives them.
directionThe message search direction. See EMConversation.EMSearchDirection.
  • (Default) UP: The SDK retrieves messages in the reverse chronological order of when the server receives them.
    • DOWN: The SDK retrieves messages in the chronological order of the time the server receives them.
Returns
The list of retrieved messages (excluding the one with the starting message ID) and the cursor for the next query.
Exceptions
HyphenateExceptionA description of the exception. See EMError.
Deprecated:
Deprecated. Use asyncFetchHistoryMessages(String, EMConversationType, int, String, EMFetchMessageOption, EMValueCallBack) instead.

◆ fetchSupportLanguages()

void com.hyphenate.chat.EMChatManager.fetchSupportLanguages ( EMValueCallBack< List< EMLanguage > >  callback)

Gets all languages supported by the translation service.

Parameters
callbackThe result callback. See EMCallBack.

◆ getAllConversations()

Map< String, EMConversation > com.hyphenate.chat.EMChatManager.getAllConversations ( )

Gets all local conversations.

Conversations will be first retrieved from the memory. If no conversation is found, the SDK retrieves from the local database.

Returns
The retrieved conversations.

◆ getAllConversationsBySort()

List< EMConversation > com.hyphenate.chat.EMChatManager.getAllConversationsBySort ( )

Gets all local conversations.

Pinned conversations are listed at the top of the list and followed by unpinned conversations.

The SDK returns conversations in the descending order of the timestamp of the latest message in them, with the pinned ones at the top of the list and followed by the unpinned ones.

Conversations will be first retrieved from the memory. If no conversation is found, the SDK retrieves from the local database.

Returns
The sorted conversation list.

◆ getConversation() [1/4]

EMConversation com.hyphenate.chat.EMChatManager.getConversation ( String  id)

Gets the conversation object by conversation ID.

The SDK will return null if the conversation is not found.

Parameters
idThe conversation ID.
Returns
The conversation with the specified ID. The SDK returns null if the conversation is not found.

◆ getConversation() [2/4]

EMConversation com.hyphenate.chat.EMChatManager.getConversation ( String  id,
EMConversationType  type 
)

Gets the conversation by conversation ID and type.

The SDK will return null if the conversation is not found.

Parameters
idThe conversation ID:
  • One-to-one chat: The ID of the peer user;
  • Group chat: The group ID;
  • Chat room chat: The chat room ID;
  • Message thread: The message thread ID.
typeThe conversation type. See EMConversationType
Returns
The conversation object found by ID and type. The SDK returns null if the conversation is not found.

◆ getConversation() [3/4]

EMConversation com.hyphenate.chat.EMChatManager.getConversation ( String  username,
EMConversationType  type,
boolean  createIfNotExists 
)

Gets the conversation object by user ID or group ID and conversation type.

Parameters
usernameThe conversation ID:
  • One-to-one chat: The ID of the peer user;
  • Group chat: The group ID;
  • Chat room chat: The chat room ID;
  • Message thread: The message thread ID.
typeThe conversation type. See EMConversationType.
createIfNotExistsWhether to create a conversation if the specified conversation is not found:
  • true: Yes;
  • false: No.
Returns
The retrieved conversation object. The SDK returns null if the conversation is not found.

◆ getConversation() [4/4]

EMConversation com.hyphenate.chat.EMChatManager.getConversation ( String  username,
EMConversationType  type,
boolean  createIfNotExists,
boolean  isChatThread 
)

Get conversation object by conversation id and conversation type.

If the conversation is not found, you can create a new object based on the value of CreateIFNotExists or an empty object.

Parameters
usernameThe conversation ID.
  • - One-to-one chat: The ID of the peer user;
    • Group chat: The group ID;
    • Chat room chat: The chat room ID;
    • Message thread: The message thread ID.
typeThe conversation type. See EMConversationType.
createIfNotExistsWhether to create a conversation if the specified conversation is not found:
  • true: Yes;
  • false: No.
isChatThreadWhether to search for the chat thread conversation.
  • true: Yes;
    • false: No.
Returns
The retrieved conversation object. The SDK returns null if the conversation is not found.

◆ getConversationsByType()

List< EMConversation > com.hyphenate.chat.EMChatManager.getConversationsByType ( EMConversationType  type)

Gets the list of conversations by conversation type.

Parameters
typeThe conversation type. See EMConversationType.
Returns
The list of conversations of the specified type.

◆ getMessage()

EMMessage com.hyphenate.chat.EMChatManager.getMessage ( String  messageId)

Gets the message by message ID.

Parameters
messageIdThe message ID.
Returns
The message object with the specified ID. The SDK returns null if the message does not exist.

◆ getReactionDetail()

EMCursorResult< EMMessageReaction > com.hyphenate.chat.EMChatManager.getReactionDetail ( final String  messageId,
final String  reaction,
final String  cursor,
final int  pageSize 
) throws HyphenateException

Gets the Reaction details.

This is a synchronous method.

Parameters
messageIdThe message ID.
reactionThe Reaction content.
cursorThe cursor position from which to start querying data.
pageSizeThe number of Reactions you expect to get on each page.
Returns
The query result EMCursorResult, which contains the list of obtained Reactions and the cursor for the next query. If the cursor is null, all data is obtained.
Exceptions
HyphenateExceptionA description of the exception, see EMError.

◆ getReactionList()

Map< String, List< EMMessageReaction > > com.hyphenate.chat.EMChatManager.getReactionList ( final List< String >  messageIdList,
final EMMessage.ChatType  chatType,
final String  groupId 
) throws HyphenateException

Gets the list of Reactions.

This is a synchronous method.

Parameters
messageIdListThe message ID.
chatTypeThe conversation type. Only the one-to-one chats (EMMessage.ChatType#Chat and group chats (EMMessage.ChatType#GroupChat) are allowed.
groupIdThe group ID, which is invalid only for group chats.
Returns
map The Reaction list under the specified message ID. The UserList of EMMessageReaction indicates the summary data, which only contains the information of the first three users.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ getUnreadMessageCount()

int com.hyphenate.chat.EMChatManager.getUnreadMessageCount ( )

Gets the unread message count.

Returns
The count of unread messages.

◆ importMessages()

synchronized void com.hyphenate.chat.EMChatManager.importMessages ( List< EMMessage msgs)

Imports messages to the local database.

You can only import messages that you sent or received.

It is recommended that you import at most 1,000 messages each time.

Parameters
msgsThe messages to import.

◆ loadAllConversations()

void com.hyphenate.chat.EMChatManager.loadAllConversations ( )

Loads all conversations from the local database into the memory.

Generally, this method is called upon successful login to speed up the loading of the conversation list.

◆ markAllConversationsAsRead()

boolean com.hyphenate.chat.EMChatManager.markAllConversationsAsRead ( )

Marks all conversations as read.

This method works only for the local conversations.

Returns
Whether all conversations are marked as read.

◆ recallMessage() [1/2]

void com.hyphenate.chat.EMChatManager.recallMessage ( EMMessage  message) throws HyphenateException

Recalls the sent message.

If the recipient is offline when the message is delivered and recalled, the recipient only receives the callback EMMessageListener#onMessageRecalled instead of the message.

This is a synchronous method and blocks the current thread.

Parameters
messageThe message instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ recallMessage() [2/2]

void com.hyphenate.chat.EMChatManager.recallMessage ( EMMessage  message,
String  ext 
) throws HyphenateException

Recalls the sent message.

If the recipient is offline when the message is delivered and recalled, the recipient only receives the callback EMMessageListener#onMessageRecalled instead of the message.

This is a synchronous method and blocks the current thread.

Parameters
messageThe message instance.
extExtended Information
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ removeConversationListener()

void com.hyphenate.chat.EMChatManager.removeConversationListener ( EMConversationListener  listener)

Removes the conversation listener.

After adding a conversation listener with addConversationListener(EMConversationListener), you can call this method to remove it when it is not required.

Parameters
listenerThe conversation listener to remove.

◆ removeMessageListener()

void com.hyphenate.chat.EMChatManager.removeMessageListener ( EMMessageListener  listener)

Removes the message listener.

After adding a message listener with addMessageListener(EMMessageListener), you can call this method to remove it when it is not required.

Parameters
listenerThe message listener to remove.

◆ removeMessagesFromServer() [1/2]

void com.hyphenate.chat.EMChatManager.removeMessagesFromServer ( String  conversationId,
EMConversationType  type,
List< String >  msgIdList,
EMCallBack  callBack 
)
protected

Unidirectionally removes historical message by message ID from the server.

Parameters
conversationIdThe conversation ID.
typeThe conversation type.
msgIdListThe list of IDs of messages to be removed.
callBackThe result callback which contains the error information if the method fails. See EMCallBack.

◆ removeMessagesFromServer() [2/2]

void com.hyphenate.chat.EMChatManager.removeMessagesFromServer ( String  conversationId,
EMConversationType  type,
long  beforeTimeStamp,
EMCallBack  callBack 
)
protected

Unidirectionally removes historical message by timestamp from the server.

Parameters
conversationIdThe conversation ID.
typeThe conversation type.
beforeTimeStampThe UNIX timestamp in millisecond. Messages with a timestamp smaller than the specified one will be removed.
callBackThe result callback which contains the error information if the method fails. See EMCallBack.

◆ removeReaction()

void com.hyphenate.chat.EMChatManager.removeReaction ( final String  messageId,
final String  reaction 
) throws HyphenateException

Deletes a Reaction.

This is a synchronous method.

Parameters
messageIdThe message ID.
reactionThe Reaction content to delete.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ reportMessage()

void com.hyphenate.chat.EMChatManager.reportMessage ( String  msgId,
String  tag,
String  reportReason 
) throws HyphenateException

Reports an inappropriate message.

This is a synchronous method and blocks the current thread.

Parameters
msgIdThe ID of the inappropriate message.
tagThe tag of the inappropriate message. You need to type a custom tag, like porn or ad.
reportReasonThe reporting reason. You need to type a specific reason.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ saveMessage()

void com.hyphenate.chat.EMChatManager.saveMessage ( EMMessage  message)

Saves the message to the memory and local database.

The command messages (type: Type#CMD, message body: EMCmdMessageBody) are not saved locally.

Parameters
messageThe message to store.

◆ searchMsgFromDB() [1/4]

List< EMMessage > com.hyphenate.chat.EMChatManager.searchMsgFromDB ( @NonNull Type  type,
long  timeStamp,
int  maxCount,
String  from,
EMConversation.EMSearchDirection  direction 
)

Retrieves messages of a certain type from the local database.

Parameters
typeThe message type. See Type.
timeStampThe starting Unix timestamp in the message for query. The unit is millisecond. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If you set this parameter as a negative value, the SDK retrieves messages, starting from the current time, in the descending order of the timestamp included in them.
maxCountThe maximum number of messages to retrieve each time. The value range is [1,400].
fromThe user ID of the message sender. If this parameter is set to null or an empty string, there is no restriction on the message sender during message search.
directionThe message search direction. See EMConversation.EMSearchDirection.
  • (Default) UP: The SDK retrieves messages in the descending order of the timestamp included in them.
    • DOWN: The SDK retrieves messages in the ascending order of the timestamp included in them.
Returns
The list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.

◆ searchMsgFromDB() [2/4]

List< EMMessage > com.hyphenate.chat.EMChatManager.searchMsgFromDB ( Set< Type types,
long  timeStamp,
int  maxCount,
String  from,
EMConversation.EMSearchDirection  direction 
)

Retrieves messages of multiple types in the conversation from the local database.

Parameters
typesThe message types. See Type.
timeStampThe starting Unix timestamp in the message for query. The unit is millisecond. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If you set this parameter as a negative value, the SDK retrieves messages, starting from the current time, in the descending order of the timestamp included in them.
maxCountThe maximum number of messages to retrieve each time. The value range is [1,400].
fromThe user ID of the message sender. If this parameter is set to null or an empty string, there is no restriction on the message sender during message search.
directionThe message search direction. See EMConversation.EMSearchDirection.
  • (Default) UP: The SDK retrieves messages in the descending order of the timestamp included in them.
    • DOWN: The SDK retrieves messages in the ascending order of the timestamp included in them.
Returns
The list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.

◆ searchMsgFromDB() [3/4]

List< EMMessage > com.hyphenate.chat.EMChatManager.searchMsgFromDB ( String  keywords,
long  timeStamp,
int  maxCount,
String  from,
EMConversation.EMSearchDirection  direction 
)

Retrieves messages with keywords in the local database.

Parameters
keywordsThe keywords for query.
timeStampThe starting Unix timestamp in the message for query. The unit is millisecond. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If you set this parameter as a negative value, the SDK retrieves messages, starting from the current time, in the descending order of the timestamp included in them.
maxCountThe maximum number of messages to retrieve each time. The value range is [1,400].
fromThe user ID of the message sender. If this parameter is set to null or an empty string, there is no restriction on the message sender during message search.
directionThe message search direction. See EMConversation.EMSearchDirection.
  • (Default) UP: The SDK retrieves messages in the descending order of the timestamp included in them.
    • DOWN: The SDK retrieves messages in the ascending order of the timestamp included in them.
Returns
The list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.

◆ searchMsgFromDB() [4/4]

List< EMMessage > com.hyphenate.chat.EMChatManager.searchMsgFromDB ( String  keywords,
long  timeStamp,
int  maxCount,
String  from,
EMConversation.EMSearchDirection  direction,
EMConversation.EMMessageSearchScope  searchScope 
)

Retrieves messages with keywords from the local database.

Parameters
keywordsThe keywords for query.
timeStampThe starting Unix timestamp in the message for query. The unit is millisecond. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If you set this parameter as a negative value, the SDK retrieves messages, starting from the current time, in the descending order of the timestamp included in them.
maxCountThe maximum number of messages to retrieve each time. The value range is [1,400]. If you set this parameter to 0 or less, the SDK gets one message from the local database.
fromThe user ID of the message sender. If this parameter is set to null or an empty string, there is no restriction on the message sender during message search.
directionThe message search direction. See EMConversation.EMSearchDirection.
  • (Default) UP: The SDK retrieves messages in the descending order of the timestamp included in them.
    • DOWN: The SDK retrieves messages in the ascending order of the timestamp included in them.
searchScopeThe message search scope. See EMConversation.EMMessageSearchScope.
Returns
The list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.

◆ sendMessage()

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

Sends a message。

For a voice or image message or a message with an attachment, the SDK will automatically upload the attachment.

You can determine whether to upload the attachment to the chat sever by setting EMOptions#setAutoTransferMessageAttachments(boolean).

To listen for the message sending status, call EMMessage#setMessageStatusCallback(EMCallBack).

Parameters
msgThe message object to be sent. Make sure to set the param.

◆ setVoiceMessageListened()

void com.hyphenate.chat.EMChatManager.setVoiceMessageListened ( EMMessage  message)

Marks a voice message as listened.

Parameters
messageThe message object.

◆ translateMessage()

void com.hyphenate.chat.EMChatManager.translateMessage ( EMMessage  message,
List< String >  languages,
EMValueCallBack< EMMessage callback 
)

Translates a text message.

Parameters
messageThe message object for translation.
languagesThe list of target language codes.
callbackThe result callback. See EMCallBack.

◆ updateMessage()

boolean com.hyphenate.chat.EMChatManager.updateMessage ( EMMessage  message)

Updates the local message.

This method updates the message in both the memory and the local database at the same time.

Parameters
messageThe message object to update.

◆ updateParticipant()

boolean com.hyphenate.chat.EMChatManager.updateParticipant ( String  from,
String  changeTo 
)

Changes the data of one contact in the local database to those of the other contact.

Note

  • This method brings changes to data such as the message list, the conversation list, contact list, the block list in the database.
  • This method does not update the data stored in the memory.
Parameters
fromThe user ID of the original contact.
changeToThe user ID of the new contact.
Returns
The operation result.
  • true: Success.
  • false: Failure.

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