hyphenate_SDK3.0
3.6.0
hyphenatejavaIMSDK
|
Classes | |
enum | EMConversationType |
enum | EMSearchDirection |
class | MessageCache |
Public Member Functions | |
String | conversationId () |
EMConversationType | getType () |
int | getUnreadMsgCount () |
void | markAllMessagesAsRead () |
int | getAllMsgCount () |
List< EMMessage > | loadMoreMsgFromDB (String startMsgId, int pageSize) |
List< EMMessage > | searchMsgFromDB (long timeStamp, int maxCount, EMSearchDirection direction) |
List< EMMessage > | searchMsgFromDB (EMMessage.Type type, long timeStamp, int maxCount, String from, EMSearchDirection direction) |
List< EMMessage > | searchMsgFromDB (String keywords, long timeStamp, int maxCount, String from, EMSearchDirection direction) |
List< EMMessage > | searchMsgFromDB (long startTimeStamp, long endTimeStamp, int maxCount) |
EMMessage | getMessage (String messageId, boolean markAsRead) |
List< EMMessage > | loadMessages (List< String > msgIds) |
void | markMessageAsRead (String messageId) |
List< EMMessage > | getAllMessages () |
void | removeMessage (String messageId) |
EMMessage | getLastMessage () |
EMMessage | getLatestMessageFromOthers () |
void | clear () |
void | clearAllMessages () |
void | setExtField (String ext) |
String | getExtField () |
boolean | isGroup () |
void | insertMessage (EMMessage msg) |
void | appendMessage (EMMessage msg) |
boolean | updateMessage (EMMessage msg) |
String | getMessageAttachmentPath () |
![]() | |
boolean | equals (Object o) |
int | hashCode () |
Static Public Member Functions | |
static EMConversationType | msgType2ConversationType (String id, EMMessage.ChatType type) |
Additional Inherited Members | |
![]() | |
T | emaObject |
EMConversation represent a conversation chating with a user, containing chat messages. Example illustrate how to get unread message count
EMConversation conversation = EMClient.getInstance().chatManager().getConversation("user1"); int unread = conversation.getUnreadMsgCount();
void com.hyphenate.chat.EMConversation.appendMessage | ( | EMMessage | msg | ) |
Insert a message to the end of a conversation in local database. ConversationId of the message should be the same as conversationId of the conversation in order to insert the message into the conversation correctly.
msg | Message |
void com.hyphenate.chat.EMConversation.clear | ( | ) |
clear messages in this conversation's from cache, but will NOT clear local database
void com.hyphenate.chat.EMConversation.clearAllMessages | ( | ) |
Delete all messages of the conversation from memory cache and local database
String com.hyphenate.chat.EMConversation.conversationId | ( | ) |
conversation ID For single chat,conversation ID is to chat user's name For group chat, conversation ID is groupID(), different with getGroupName() For chat room, conversation ID is chatroom ID, different with chat room name() For help desk, it is same with single chat, conversationID is also chat user's name
List<EMMessage> com.hyphenate.chat.EMConversation.getAllMessages | ( | ) |
get all message in local cache, if empty, then get from local database.
int com.hyphenate.chat.EMConversation.getAllMsgCount | ( | ) |
get all messages count in this conversation
String com.hyphenate.chat.EMConversation.getExtField | ( | ) |
get conversation's extend field, extend field only stored in local database, not sync to network server.
EMMessage com.hyphenate.chat.EMConversation.getLastMessage | ( | ) |
get last message from conversation
EMMessage com.hyphenate.chat.EMConversation.getLatestMessageFromOthers | ( | ) |
Get received latest message from conversation.
EMMessage com.hyphenate.chat.EMConversation.getMessage | ( | String | messageId, |
boolean | markAsRead | ||
) |
get message by message ID, if the message already loaded into memory cache, will directly return the message, otherwise load message from database, and put it into cache.
messageId | |
markAsRead | if true, will mark the message as read and send read ack to server |
String com.hyphenate.chat.EMConversation.getMessageAttachmentPath | ( | ) |
return conversation associated attachment path, can be used to erase conversation related downloaded files from local storage. not ensure the return path exists, please handle IOException when deleting directory
EMConversationType com.hyphenate.chat.EMConversation.getType | ( | ) |
get conversation type
int com.hyphenate.chat.EMConversation.getUnreadMsgCount | ( | ) |
get unread message count
void com.hyphenate.chat.EMConversation.insertMessage | ( | EMMessage | msg | ) |
Insert a message to a conversation in local database. ConversationId of the message should be the same as conversationId of the conversation in order to insert the message into the conversation correctly. The inserting message will be inserted based on timestamp.
msg | Message |
boolean com.hyphenate.chat.EMConversation.isGroup | ( | ) |
group chat and chatroom chat will both return true
List<EMMessage> com.hyphenate.chat.EMConversation.loadMessages | ( | List< String > | msgIds | ) |
load messages, if those message not exists in memory in cache, will load message from database.
msgIds | messages to be loaded. |
List<EMMessage> com.hyphenate.chat.EMConversation.loadMoreMsgFromDB | ( | String | startMsgId, |
int | pageSize | ||
) |
load message from database, message id starting from param startMsgId, messages will also store in to memory cache so next time calling getAllMessages(), result will contain those messages
startMsgId | message storage time will before this ID, if startMsgId is "" or null, will load last messages in database. |
pageSize | message count to be loaded. |
void com.hyphenate.chat.EMConversation.markAllMessagesAsRead | ( | ) |
Mark all messages as read
void com.hyphenate.chat.EMConversation.markMessageAsRead | ( | String | messageId | ) |
mark the message as read, and send read as to server.
messageId | messageID |
|
static |
provide transformation from message type to conversation type
id | message Id, used to distinguish single chat and help desk, has no effect on other chat type. |
type | message type |
void com.hyphenate.chat.EMConversation.removeMessage | ( | String | messageId | ) |
delete a message
messageId | message to be deleted |
List<EMMessage> com.hyphenate.chat.EMConversation.searchMsgFromDB | ( | long | timeStamp, |
int | maxCount, | ||
EMSearchDirection | direction | ||
) |
search message from database according the parameter Note: Cautious about memory usage when the maxCount is large
timeStamp | the timestamp for search |
maxCount | the max number of message to search |
List<EMMessage> com.hyphenate.chat.EMConversation.searchMsgFromDB | ( | EMMessage.Type | type, |
long | timeStamp, | ||
int | maxCount, | ||
String | from, | ||
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.EMConversation.searchMsgFromDB | ( | String | keywords, |
long | timeStamp, | ||
int | maxCount, | ||
String | from, | ||
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 |
List<EMMessage> com.hyphenate.chat.EMConversation.searchMsgFromDB | ( | long | startTimeStamp, |
long | endTimeStamp, | ||
int | maxCount | ||
) |
search message from database based the parameters Note: Cautious about memory usage when the maxCount is large
startTimeStamp | start timestamp for search in. |
startTimeStamp | end timestamp for search |
maxCount | the max number of message to search |
void com.hyphenate.chat.EMConversation.setExtField | ( | String | ext | ) |
set Conversation extension. extend field only stored in local database, not sync to network server.
ext | extension string |
boolean com.hyphenate.chat.EMConversation.updateMessage | ( | EMMessage | msg | ) |
Update a message in local database. latestMessage of the conversation and other properties will be updated accordingly. messageId of the message cannot be updated
msg | Message |