public interface MsgService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MSG_CHATTING_ACCOUNT_ALL
No chat but alerts messages can be seen on the message UI.
|
static java.lang.String |
MSG_CHATTING_ACCOUNT_NONE
No chat.
|
Modifier and Type | Method and Description |
---|---|
InvocationFuture<CollectInfo> |
addCollect(int type,
java.lang.String date,
java.lang.String ext,
java.lang.String uniqueId)
Add a bookmark
|
InvocationFuture<java.lang.Long> |
addMsgPin(IMMessage msg,
java.lang.String ext)
Add a PIN tag to a message
|
InvocationFuture<java.lang.Void> |
addQuickComment(IMMessage msg,
long replyType,
java.lang.String ext)
Add a quick comment.
|
InvocationFuture<java.lang.Long> |
addQuickComment(IMMessage msg,
long replyType,
java.lang.String ext,
boolean needPush,
boolean needBadge,
java.lang.String pushTitle,
java.lang.String pushContent,
java.util.Map<java.lang.String,java.lang.Object> pushPayload)
Add a quick comment.
|
InvocationFuture<StickTopSessionInfo> |
addStickTopSession(java.lang.String sessionId,
SessionTypeEnum sessionType,
java.lang.String ext)
Add a pinned session
|
InvocationFuture<java.lang.Void> |
cancelUploadAttachment(IMMessage imMessage)
Cancel uploading message attachment, such as image, video, and file.
|
LocalAntiSpamResult |
checkLocalAntiSpam(java.lang.String content,
java.lang.String replacement)
Check local spam trigger words
|
void |
clearAllUnreadCount()
Clear all unread count of all contacts (tag read)
The interface call also triggers
MsgServiceObserve.observeRecentContact(Observer, boolean) notifications |
void |
clearChattingHistory(java.lang.String account,
SessionTypeEnum sessionType)
Clear all messages of a specified user and the clear operation is not recorded in the database.
|
void |
clearChattingHistory(java.lang.String account,
SessionTypeEnum sessionType,
boolean ignore)
Clear all local messages of a specified user.
|
InvocationFuture<java.lang.Void> |
clearMsgDatabase(boolean clearRecent)
Clear all messages in the database.
|
void |
clearServerHistory(java.lang.String sessionId,
boolean deleteRoam)
Clear history P2P messages
|
void |
clearServerHistory(java.lang.String sessionId,
SessionTypeEnum sessionType)
Clear history P2P messages.
|
void |
clearServerHistory(java.lang.String sessionId,
SessionTypeEnum sessionType,
boolean deleteRoam)
Deprecated.
Roaming messages for P2P chats can be retained on the server.
To retain roaming messages, use
clearServerHistory(String, boolean)
To delete roaming messages, use clearServerHistory(String, SessionTypeEnum) |
void |
clearServerHistory(java.lang.String sessionId,
SessionTypeEnum sessionType,
boolean sync,
java.lang.String ext)
Clear history messages.
|
InvocationFuture<java.util.List<SessionAckInfo>> |
clearUnreadCount(java.util.List<<any>> sessionKeyList)
Set the unread count of specified recent contact to 0 (tag read).
|
InvocationFuture<java.lang.Void> |
clearUnreadCount(java.lang.String account,
SessionTypeEnum sessionType)
Set the unread count of specified recent contact to 0 (tag read).
|
RecentContact |
createEmptyRecentContact(java.lang.String contactId,
SessionTypeEnum sessionType,
long tag,
long time,
boolean saveToDB)
Create an empty session with a specified contact
|
RecentContact |
createEmptyRecentContact(java.lang.String contactId,
SessionTypeEnum sessionType,
long tag,
long time,
boolean saveToDB,
boolean withLastMsg)
Create an empty session with a specified contact
|
void |
deleteChattingHistory(IMMessage message)
Delete a message and record the delete operation in the database.
|
void |
deleteChattingHistory(IMMessage message,
boolean ignore)
Delete a message
|
void |
deleteChattingHistory(java.util.List<IMMessage> msgList,
boolean ignore)
Delete multiple messages
|
InvocationFuture<java.lang.Long> |
deleteMsgSelf(IMMessage msg,
java.lang.String ext)
Delete a message sent from the current user
|
InvocationFuture<java.lang.Long> |
deleteMsgSelf(java.util.List<IMMessage> msgList,
java.lang.String ext)
Delete multiple messages sent from the current user.
|
InvocationFuture<java.lang.Void> |
deleteMySession(java.lang.String[] sessionIdArr)
Delete a session
|
void |
deleteRangeHistory(java.lang.String account,
SessionTypeEnum sessionType,
long startTime,
long endTime)
Delete local history messages with in a time range between startTime and entTime.
|
void |
deleteRecentContact(RecentContact recent)
Delete a recent contact session from a local storage and roaming data.
|
InvocationFuture<java.lang.Void> |
deleteRecentContact(java.lang.String account,
SessionTypeEnum sessionType,
DeleteTypeEnum deleteType,
boolean sendAck)
Delete a recent contact record
The method call will trigger MsgServiceObserve.observeRecentContactDeleted(Observer, boolean) to send a notification. |
void |
deleteRecentContact2(java.lang.String account,
SessionTypeEnum sessionType)
Delete a recent contact record from the local storage and roaming data.
|
InvocationFuture<java.lang.Void> |
deleteRoamingRecentContact(java.lang.String contactId,
SessionTypeEnum sessionTypeEnum)
Delete the roaming messages of a specified recent contact.
|
void |
deleteRoamMsgHasMoreTag(java.lang.String sessionId,
SessionTypeEnum sessionType)
Delete the tag for more roaming messages
|
AbortableFuture<java.lang.Void> |
downloadAttachment(IMMessage msg,
boolean thumb)
In most cases, attachments will be automatically downloaded when messages are received.
|
boolean |
everBeenDeleted(IMMessage message)
Check if the message is deleted from the local storage.
|
AbortableFuture<java.lang.Void> |
exportAllMessage(IMsgExportProcessor exportProcessor,
boolean safeMode)
Export all messages stored in the local database and upload the messages to the server.
|
int |
getTotalUnreadCount()
Get the total unread count
|
int |
getTotalUnreadCount(boolean notify)
Get the total unread count
|
AbortableFuture<java.lang.Void> |
importAllMessage(IMsgImportProcessor iMsgImportProcessor,
boolean safeMode)
Import exported messages.
|
InvocationFuture<java.lang.Void> |
importRecentSessions(java.util.List<<any>> sessions)
Import multiple recent sessions with contactId and sessionType fields
|
InvocationFuture<java.lang.Void> |
insertLocalMessage(IMMessage msg,
java.lang.String fromAccount)
Insert a message into the local database and update the UI interface but the message is not sent to the server.
|
boolean |
isStickTopSession(java.lang.String sessionId,
SessionTypeEnum sessionType)
Check if the session is pinned.
|
void |
migrateMessages(java.lang.String from,
java.lang.String to,
boolean changeFrom)
Migrate message data Migrate history message data of accounts in the from field to the message data of accounts in the to field.
|
InvocationFuture<java.util.List<IMMessage>> |
pullHistoryById(java.util.List<MessageKey> msgKeyList,
boolean persist)
Query history messages by message ID.
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistory(IMMessage anchor,
int limit,
boolean persist)
Get history messages from the server.
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistory(IMMessage anchor,
int limit,
boolean persist,
boolean persistClear)
Get history messages from the server.
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistory(MsgFullKeywordSearchConfig config)
Global search for history messages on the cloud
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistoryEx(IMMessage anchor,
long toTime,
int limit,
QueryDirectionEnum direction,
boolean persist)
Get history messages from the server.
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistoryExType(IMMessage anchor,
long toTime,
int limit,
QueryDirectionEnum direction,
MsgTypeEnum[] msgTypes)
Get history messages from the server with a specified type.
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistoryExType(IMMessage anchor,
long toTime,
int limit,
QueryDirectionEnum direction,
MsgTypeEnum[] msgTypes,
boolean persist)
Get history messages from the server with a specified type.
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistoryExType(IMMessage anchor,
long toTime,
int limit,
QueryDirectionEnum direction,
MsgTypeEnum[] msgTypes,
boolean persist,
boolean persistClear)
Get history messages from the server with a specified type.
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistoryExType(IMMessage anchor,
long toTime,
int limit,
QueryDirectionEnum direction,
MsgTypeEnum[] msgTypes,
boolean persist,
boolean persistClear,
IMMessageFilter customFilter)
Get history messages from the server with a specified type.
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistoryExType(IMMessage anchor,
long toTime,
int limit,
QueryDirectionEnum direction,
MsgTypeEnum[] msgTypes,
boolean persist,
boolean persistClear,
IMMessageFilter customFilter,
boolean updateUnread)
Get history messages from the server with a specified type.
|
InvocationFuture<java.util.List<IMMessage>> |
pullMessageHistoryOrderByTime(MsgTimingFullKeywordSearchConfig config)
Global search for history messages on the cloud by time not session group
|
InvocationFuture<CollectInfoPage> |
queryCollect(CollectInfo anchor,
long toTime,
int limit,
QueryDirectionEnum direction)
Query bookmarks on the server page
|
InvocationFuture<CollectInfoPage> |
queryCollect(CollectInfo anchor,
long toTime,
int limit,
QueryDirectionEnum direction,
int type,
boolean persist)
Query bookmarks on the service page
|
InvocationFuture<CollectInfoPage> |
queryCollect(int limit)
Query bookmarks
|
IMMessage |
queryLastMessage(java.lang.String account,
SessionTypeEnum sessionType)
Query the most recent message of a specifed user
|
InvocationFuture<java.util.List<IMMessage>> |
queryMessageList(java.lang.String account,
SessionTypeEnum sessionType,
long offset,
int limit)
Deprecated.
|
java.util.List<IMMessage> |
queryMessageListByServerIdBlock(java.util.List<java.lang.String> serverIds)
Get multiple messages using the Server ID (sync)
Note: a server ID can be associated with multiple messages
|
InvocationFuture<java.util.List<IMMessage>> |
queryMessageListBySubtype(MsgTypeEnum msgTypeEnum,
IMMessage anchor,
int limit,
int subtype)
Query local messages by subtype (async)
|
java.util.List<IMMessage> |
queryMessageListBySubtypeBlock(MsgTypeEnum msgTypeEnum,
IMMessage anchor,
int limit,
int subtype)
Query local messages by subtype (sync)
|
InvocationFuture<java.util.List<IMMessage>> |
queryMessageListByType(MsgTypeEnum msgTypeEnum,
IMMessage anchor,
int limit)
query history messages on the local database by type.
|
InvocationFuture<java.util.List<IMMessage>> |
queryMessageListByType(MsgTypeEnum msgTypeEnum,
java.lang.Long maxTime,
int limit)
Query all messages by message type
|
InvocationFuture<java.util.List<IMMessage>> |
queryMessageListByTypes(java.util.List<MsgTypeEnum> types,
IMMessage anchor,
long toTime,
QueryDirectionEnum direction,
int limit,
boolean asc)
Query history messages based on the start time, end time, and direction.
|
InvocationFuture<java.util.List<IMMessage>> |
queryMessageListByUuid(java.util.List<java.lang.String> uuids)
Get multiple messages with UUIDs
|
java.util.List<IMMessage> |
queryMessageListByUuidBlock(java.util.List<java.lang.String> uuids)
Get multiple messages (sync)
|
InvocationFuture<java.util.List<IMMessage>> |
queryMessageListEx(IMMessage anchor,
QueryDirectionEnum direction,
int limit,
boolean asc)
Query history messages on the local database by anchor and direction
Query messages earlier than or later than the anchor by direction with a limit. |
java.util.List<IMMessage> |
queryMessageListExBlock(IMMessage anchor,
QueryDirectionEnum direction,
int limit,
boolean asc)
Query history messages on the local database by anchor and direction (sync)
Query messages earlier than or later than the anchor by direction with a limit. |
InvocationFuture<java.util.List<IMMessage>> |
queryMessageListExTime(IMMessage anchor,
long toTime,
QueryDirectionEnum direction,
int limit)
query history messages on the local database based on the start time, end time, and direction.
|
java.util.List<MsgPinDbOption> |
queryMsgPinBlock(java.lang.String sessionId,
SessionTypeEnum sessionType)
Get a list of PIN messages
|
InvocationFuture<RecentSession> |
queryMySession(java.lang.String sessionId)
Get a session
|
InvocationFuture<RecentSessionList> |
queryMySessionList(long minTimestamp,
java.lang.Long maxTimestamp,
java.lang.Integer needLastMsg,
java.lang.Integer limit,
java.lang.Integer hasMore)
Deprecated.
|
InvocationFuture<RecentSessionList> |
queryMySessionList(QueryMySessionOption option)
Get a list of session by increment.
|
InvocationFuture<java.util.List<QuickCommentOptionWrapper>> |
queryQuickComment(java.util.List<IMMessage> msgList)
Get a quick comment
|
RecentContact |
queryRecentContact(java.lang.String contactId,
SessionTypeEnum sessionType)
Query session records in the database by contactId and sessionType.
|
InvocationFuture<java.util.List<RecentContact>> |
queryRecentContacts()
Query the recent contact list
|
InvocationFuture<java.util.List<RecentContact>> |
queryRecentContacts(int limit)
Query the recent contact list.
|
InvocationFuture<java.util.List<RecentContact>> |
queryRecentContacts(MsgTypeEnum filterMsgType)
Query the recent contact list.
|
InvocationFuture<java.util.List<RecentContact>> |
queryRecentContacts(RecentContact anchor,
QueryDirectionEnum direction,
int limit)
Query the recent contact list sorted in descending or ascending order with a limit of displayed contacts.
|
InvocationFuture<java.util.List<RecentContact>> |
queryRecentContacts(java.util.Set<MsgTypeEnum> filterMsgTypeSet)
Query the recent contact list.
|
java.util.List<RecentContact> |
queryRecentContactsBlock()
Query the recent contact list (sync)
|
java.util.List<RecentContact> |
queryRecentContactsBlock(int limit)
Query the recent contact list (sync).
|
java.util.List<RecentContact> |
queryRecentContactsBlock(MsgTypeEnum filterMsgType)
Query the recent contact list (sync).
|
java.util.List<RecentContact> |
queryRecentContactsBlock(RecentContact anchor,
QueryDirectionEnum direction,
int limit)
Query the recent contact list (sync) sorted in descending or ascending order with a limit of displayed contacts.
|
java.util.List<RecentContact> |
queryRecentContactsBlock(java.util.Set<MsgTypeEnum> filterMsgTypeSet)
Query the recent contact list (sync).
|
int |
queryReplyCountInThreadTalkBlock(IMMessage msg)
Get the reply count of a thread chat.
|
InvocationFuture<java.lang.Long> |
queryRoamMsgHasMoreTagServerId(java.lang.String sessionId,
SessionTypeEnum sessionType)
Get roaming messages with a specified server ID.
|
long |
queryRoamMsgHasMoreTagServerIdBlock(java.lang.String sessionId,
SessionTypeEnum sessionType)
Get roaming messages with a specified server ID.
|
InvocationFuture<java.lang.Long> |
queryRoamMsgHasMoreTime(java.lang.String sessionId,
SessionTypeEnum sessionType)
Get the timestamp of roaming messages.
|
long |
queryRoamMsgHasMoreTimeBlock(java.lang.String sessionId,
SessionTypeEnum sessionType)
Get the timestamp of roaming messages.
|
java.util.List<StickTopSessionInfo> |
queryStickTopSessionBlock()
Get the pinned sessions
|
InvocationFuture<ThreadTalkHistory> |
queryThreadTalkHistory(IMMessage anchor,
long fromTime,
long toTime,
int limit,
QueryDirectionEnum direction,
boolean persist)
Query history thread chats on the cloud.
|
InvocationFuture<java.util.List<IMMessage>> |
queryUnreadMessageList(java.lang.String sessionId,
SessionTypeEnum sessionType)
query all unread messages by session ID and type
|
java.util.List<IMMessage> |
queryUnreadMessageListBlock(java.lang.String sessionId,
SessionTypeEnum sessionType)
query all unread messages by session ID and type (sync)
|
void |
registerCustomAttachmentParser(MsgAttachmentParser customParser)
If third party apps require custom message types with attachments, the attachment parser must also be registered.
|
void |
registerIMMessageFilter(IMMessageFilter filter)
Register the message filter
|
void |
registerShouldShowNotificationWhenRevokeFilter(ShowNotificationWhenRevokeFilter filter)
Register the filter to show notifications when a message is recalled.
|
InvocationFuture<java.lang.Integer> |
removeCollect(java.util.List<<any>> collectInfo)
Remove multiple bookmarks
|
InvocationFuture<java.lang.Long> |
removeMsgPin(IMMessage msg,
java.lang.String ext)
Remove the PIN tag of a message
|
InvocationFuture<java.lang.Void> |
removeQuickComment(IMMessage msg,
long replyType,
java.lang.String ext)
Remove a quick comment
|
InvocationFuture<java.lang.Long> |
removeQuickComment(IMMessage msg,
long replyType,
java.lang.String ext,
boolean needPush,
boolean needBadge,
java.lang.String pushTitle,
java.lang.String pushContent,
java.util.Map<java.lang.String,java.lang.Object> pushPayload)
Remove a quick comment
|
InvocationFuture<java.lang.Void> |
removeStickTopSession(java.lang.String sessionId,
SessionTypeEnum sessionType,
java.lang.String ext)
Delete a pinned session
|
InvocationFuture<java.lang.Void> |
replyMessage(IMMessage msg,
IMMessage replyMsg,
boolean resend)
Reply a message.
|
InvocationFuture<java.lang.Void> |
revokeMessage(IMMessage message)
Recall a messages.
|
InvocationFuture<java.lang.Void> |
revokeMessage(IMMessage message,
java.lang.String customApnsText,
java.util.Map<java.lang.String,java.lang.Object> pushPayload,
boolean shouldNotifyBeCount)
Recall a message and set third-party push notifications including the iOS platform and changes of the unread count.
|
InvocationFuture<java.lang.Void> |
revokeMessage(IMMessage message,
java.lang.String customApnsText,
java.util.Map<java.lang.String,java.lang.Object> pushPayload,
boolean shouldNotifyBeCount,
java.lang.String postscript)
Recall a message and set third-party push notifications including the iOS platform and changes of the unread count.
|
InvocationFuture<java.lang.Void> |
revokeMessage(IMMessage message,
java.lang.String customApnsText,
java.util.Map<java.lang.String,java.lang.Object> pushPayload,
boolean shouldNotifyBeCount,
java.lang.String postscript,
java.lang.String attach)
Recall a message and set third-party push notifications including the iOS platform and changes of the unread count.
|
InvocationFuture<java.lang.Void> |
revokeMessageEx(IMMessage message,
java.lang.String customApnsText,
java.util.Map<java.lang.String,java.lang.Object> pushPayload)
Recall a message and set third party push notifications, including the iOS platform.
|
InvocationFuture<java.lang.Void> |
saveMessageToLocal(IMMessage msg,
boolean notify)
Store the message to the local database instead of server side.
|
InvocationFuture<java.lang.Void> |
saveMessageToLocalEx(IMMessage msg,
boolean notify,
long time)
Store the message to the local database instead of server side.
|
InvocationFuture<java.util.List<IMMessage>> |
searchAllMessage(MsgSearchOption option)
Global search for all history messages on the local database.
|
InvocationFuture<java.util.List<IMMessage>> |
searchAllMessageHistory(java.lang.String keyword,
java.util.List<java.lang.String> fromAccounts,
long time,
int limit)
Query history messages on the local database.
|
InvocationFuture<java.util.List<MsgIndexRecord>> |
searchAllSession(java.lang.String query,
int limit)
Query all sessions and return the count of all matched messages from each session and the most recent message that hit the search condition.
|
java.util.List<MsgIndexRecord> |
searchAllSessionBlock(java.lang.String query,
int limit)
Query all sessions and return the count of all matched messages from each session and the most recent message that hit the search condition.
|
InvocationFuture<java.util.List<IMMessage>> |
searchMessage(SessionTypeEnum sessionType,
java.lang.String sessionId,
MsgSearchOption option)
Query history messages on the local database.
|
InvocationFuture<java.util.List<IMMessage>> |
searchMessageHistory(java.lang.String keyword,
java.util.List<java.lang.String> fromAccounts,
IMMessage anchor,
int limit)
Query history messages on the local database.
|
InvocationFuture<java.util.List<IMMessage>> |
searchMessageHistory(java.lang.String keyword,
java.util.List<java.lang.String> fromAccounts,
IMMessage anchor,
QueryDirectionEnum direction,
int limit)
Query history messages on the local database.
|
InvocationFuture<java.util.ArrayList<IMMessage>> |
searchRoamingMsg(java.lang.String otherAccid,
long fromTime,
long endTime,
java.lang.String keyword,
int limit,
boolean reverse)
Search chat records using keywords
|
InvocationFuture<java.util.List<MsgIndexRecord>> |
searchSession(java.lang.String query,
SessionTypeEnum sessionType,
java.lang.String sessionId)
Query messages in a specified session and return the matched result.
|
java.util.List<MsgIndexRecord> |
searchSessionBlock(java.lang.String query,
SessionTypeEnum sessionType,
java.lang.String sessionId)
Query messages in a specified session and return the matched result.
|
InvocationFuture<java.lang.Void> |
sendCustomNotification(CustomNotification notification)
Send an instruction message.
|
AbortableFuture<FileAttachment> |
sendFile(FileAttachment attachment)
Upload a file
|
InvocationFuture<java.lang.Void> |
sendMessage(IMMessage msg,
boolean resend)
Sending a message.
|
InvocationFuture<java.lang.Void> |
sendMessageReceipt(java.lang.String sessionId,
IMMessage message)
Send read receipt of P2P messages.
|
void |
setChattingAccount(java.lang.String account,
SessionTypeEnum sessionType)
Set the current chat peer The built-in message alert will be affected.
|
InvocationFuture<MsgPinSyncResponseOptionWrapper> |
syncMsgPin(SessionTypeEnum sessionType,
java.lang.String sessionId,
long timestamp)
Sync PIN messages in a session
|
AbortableFuture<java.lang.String> |
transVoiceToText(java.lang.String voiceUrl,
java.lang.String path,
long duration)
Convert voice to text
|
AbortableFuture<java.lang.String> |
transVoiceToTextAtScene(java.lang.String voiceUrl,
java.lang.String path,
long duration,
java.lang.String sceneKey)
Convert voice to text and specify a file for upload
|
AbortableFuture<java.lang.String> |
transVoiceToTextEnableForce(java.lang.String voiceUrl,
java.lang.String path,
long duration,
java.lang.String sceneKey,
boolean enableForceUploadFile)
Convert voice to text and specify a file for upload.
|
InvocationFuture<CollectInfo> |
updateCollect(CollectInfo info,
java.lang.String ext)
Update the extension field of the bookmark
|
InvocationFuture<CollectInfo> |
updateCollect(long infoId,
long createTime,
java.lang.String ext)
Update the extension field of the bookmark
|
void |
updateIMMessage(IMMessage message)
Update messages.
|
void |
updateIMMessageStatus(IMMessage message)
Update message status.
|
InvocationFuture<java.lang.Long> |
updateMsgPin(IMMessage msg,
java.lang.String ext)
Update a PIN message
|
InvocationFuture<java.lang.Void> |
updateMySession(java.lang.String sessionId,
java.lang.String ext)
Update the extension field of a session.
|
void |
updateRecent(RecentContact recent)
Update the property of a recent contact
To receive notifications from MsgServiceObserve.observeRecentContact(Observer, boolean) , use updateRecentAndNotify(RecentContact) Properties that can be set: tag and extension |
void |
updateRecentAndNotify(RecentContact recent)
Update the property of a recent contact and trigger a notification sent by
MsgServiceObserve.observeRecentContact(Observer, boolean) . |
void |
updateRecentByMessage(IMMessage message,
boolean needNotify)
Update a recent contact by sending a message.
|
void |
updateRoamMsgHasMoreTag(IMMessage newTag)
Update the tag of more roaming messages
|
InvocationFuture<StickTopSessionInfo> |
updateStickTopSession(java.lang.String sessionId,
SessionTypeEnum sessionType,
java.lang.String ext)
Update the extension field of a pinned session
|
static final java.lang.String MSG_CHATTING_ACCOUNT_ALL
static final java.lang.String MSG_CHATTING_ACCOUNT_NONE
InvocationFuture<java.lang.Void> sendMessage(IMMessage msg, boolean resend)
MsgServiceObserve.observeMsgStatus(Observer, boolean)
msg
- Message body constructed by MessageBuilder
resend
- To resend the message if failed, set the value to true. Otherwise, set the value to false.InvocationFuture<java.lang.Void> replyMessage(IMMessage msg, IMMessage replyMsg, boolean resend)
MsgServiceObserve.observeMsgStatus(Observer, boolean)
msg
- Message body constructed by MessageBuilder
replyMsg
- The message to be replied.resend
- To resend the message if failed, set the value to true. Otherwise, set the value to false.AbortableFuture<FileAttachment> sendFile(FileAttachment attachment)
InvocationFuture<java.lang.Void> insertLocalMessage(IMMessage msg, java.lang.String fromAccount)
MsgServiceObserve.observeReceiveMessage(Observer, boolean)
is triggered.msg
- Message to be savedfromAccount
- The sender IDInvocationFuture<java.lang.Void> saveMessageToLocal(IMMessage msg, boolean notify)
MsgServiceObserve.observeReceiveMessage(Observer, boolean)
will be triggered.msg
- Message to be savednotify
- Specify whether to update the UI view for the messageInvocationFuture<java.lang.Void> saveMessageToLocalEx(IMMessage msg, boolean notify, long time)
MsgServiceObserve.observeReceiveMessage(Observer, boolean)
will be triggered.msg
- Message to be savednotify
- Specify whether to update the UI view for the messagetime
- Set the time when a message is saved using IMMessage.getTime()
AbortableFuture<java.lang.Void> downloadAttachment(IMMessage msg, boolean thumb)
msg
- The message enclosed with an attachmentthumb
- Specify whether to download the thumbnail or the original file. If the value is set to true, only the thumbnail will be downloaded. java.util.List<IMMessage> queryMessageListByUuidBlock(java.util.List<java.lang.String> uuids)
uuids
- UUID list of messagesInvocationFuture<java.util.List<IMMessage>> queryMessageListByUuid(java.util.List<java.lang.String> uuids)
uuids
- UUID list of messagesjava.util.List<IMMessage> queryMessageListByServerIdBlock(java.util.List<java.lang.String> serverIds)
serverIds
- List of server IDsInvocationFuture<java.util.List<IMMessage>> queryMessageListByType(MsgTypeEnum msgTypeEnum, IMMessage anchor, int limit)
msgTypeEnum
- Message typeanchor
- The anchor for searchlimit
- The result limitInvocationFuture<java.util.List<IMMessage>> queryMessageListByType(MsgTypeEnum msgTypeEnum, java.lang.Long maxTime, int limit)
maxTime
- The start time (start time not included). Display a maximum of limit messages from the start time. If the maxTime parameter is empty, all messages are queried.msgTypeEnum
- Message typelimit
- The number of messages by each call. If limit is less than or equal to 0, a parameter error message is returned.java.util.List<IMMessage> queryMessageListBySubtypeBlock(MsgTypeEnum msgTypeEnum, IMMessage anchor, int limit, int subtype)
msgTypeEnum
- Message typeanchor
- The anchor for searchlimit
- The result limitchild
- message subtypeInvocationFuture<java.util.List<IMMessage>> queryMessageListBySubtype(MsgTypeEnum msgTypeEnum, IMMessage anchor, int limit, int subtype)
child
- message subtypeanchor
- The anchor for searchlimit
- The result limitInvocationFuture<java.util.List<IMMessage>> queryMessageList(java.lang.String account, SessionTypeEnum sessionType, long offset, int limit)
queryMessageListEx(IMMessage, QueryDirectionEnum, int, boolean)
account
- The peer account to be queried (individual account or group ID)sessionType
- Session type (P2P or group chat)offset
- query offsetlimit
- Limit of messages displayed per pageInvocationFuture<java.util.List<IMMessage>> queryMessageListEx(IMMessage anchor, QueryDirectionEnum direction, int limit, boolean asc)
anchor
- Query anchordirection
- Query directionlimit
- The limit of messages per queryasc
- The sorting order of the result. True: in ascending order; false: in descending order.java.util.List<IMMessage> queryMessageListExBlock(IMMessage anchor, QueryDirectionEnum direction, int limit, boolean asc)
anchor
- Query anchordirection
- Query directionlimit
- The limit of messages per queryasc
- The sorting order of the result. True: in ascending order; false: in descending order.InvocationFuture<java.util.List<IMMessage>> queryMessageListExTime(IMMessage anchor, long toTime, QueryDirectionEnum direction, int limit)
anchor
- Query anchortoTime
- the end time for a query. If the direction is set to QUERY_OLD, toTime must be less than anchor.getTime(). If the direction is set to QUERY_NEW, toTime must be greater than anchor.getTime(). direction
- Query directionlimit
- The limit of messages per queryInvocationFuture<java.util.List<IMMessage>> queryMessageListByTypes(java.util.List<MsgTypeEnum> types, IMMessage anchor, long toTime, QueryDirectionEnum direction, int limit, boolean asc)
types
- types of messages for query. A value of null indicates all message types. The result is the same as queryMessageListExTime(com.netease.nimlib.sdk.msg.model.IMMessage, long, com.netease.nimlib.sdk.msg.model.QueryDirectionEnum, int)
.anchor
- Query anchortoTime
- the end time for a query. If the direction is set to QUERY_OLD, toTime must be less than anchor.getTime(). If the direction is se to QUERY_NEW, toTime must be greater than anchor.getTime(). A value of 0 indicates no time limit. The number of messags returned is controlled by the limit parameter.direction
- Query directionlimit
- The limit of messages per queryasc
- The sorting order of the result. True: in ascending order; false: in descending order.InvocationFuture<java.lang.Long> queryRoamMsgHasMoreTime(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session IDsessionType
- Session typelong queryRoamMsgHasMoreTimeBlock(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session IDsessionType
- Session typeInvocationFuture<java.lang.Long> queryRoamMsgHasMoreTagServerId(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session IDsessionType
- Session typelong queryRoamMsgHasMoreTagServerIdBlock(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session IDsessionType
- Session typeInvocationFuture<java.util.List<IMMessage>> pullHistoryById(java.util.List<MessageKey> msgKeyList, boolean persist)
msgKeyList
- Keywords for querypersist
- Specify whether to persist the resultIMMessage queryLastMessage(java.lang.String account, SessionTypeEnum sessionType)
account
- User accountsessionType
- Session typeInvocationFuture<java.util.List<IMMessage>> pullMessageHistory(IMMessage anchor, int limit, boolean persist)
anchor
- Query anchor MessageBuilder.createEmptyMessage(String, SessionTypeEnum, long)
to create an empty object for the first time.limit
- The upper limited of the returned result of the query (100 messages)persist
- Specify whether to persist the result to the local database.InvocationFuture<java.util.List<IMMessage>> pullMessageHistory(IMMessage anchor, int limit, boolean persist, boolean persistClear)
anchor
- Query anchor MessageBuilder.createEmptyMessage(String, SessionTypeEnum, long)
to create an empty object for the first time.limit
- The upper limited of the returned result of the query (100 messages)persist
- Specify whether to persist the result to the local database.persistClear
- Specify whether to persist the messages before clearing to the local storage. The setting applies when persist is set to true.InvocationFuture<java.util.List<IMMessage>> pullMessageHistoryEx(IMMessage anchor, long toTime, int limit, QueryDirectionEnum direction, boolean persist)
anchor
- The start time. A value of null is not allowed. MessageBuilder.createEmptyMessage(String, SessionTypeEnum, long)
.toTime
- The end time in millisecondslimit
- The upper limit of the returned messages (100)direction
- The query direction. QUERY_OLD: desceding order; QUERY_NEW: ascending order.persist
- Specify whether to persist the result to the local database.InvocationFuture<java.util.List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit, QueryDirectionEnum direction, MsgTypeEnum[] msgTypes)
The query starts from the anchor (excluded) to toTime based on the direction parameter. The result of messages in a limit number is returned.
The query scope is determined by toTime and limit. The parameter that applies first is prioritized. For example, if the messages sent or received between the anchor and toTime is greater than the limit number, the limit number of messages are returned. If less than the limit number, the actual number of messages are returned.
The returned result may have a smaller size than the limit. The result is not stored in the database by default.
anchor
- The start time. A value of null is not allowed. MessageBuilder.createEmptyMessage(String, SessionTypeEnum, long)
.toTime
- The end time in millisecondslimit
- The upper limit of the returned messages (100)direction
- The query direction. QUERY_OLD: desceding order; QUERY_NEW: ascending order.msgTypes
- Message types in an array. Message types, 0: text; 1: image; 2: audio; 3: video; 4: location; 5: notification; 6: file; 10: Tip; 100: custom. Other types are invalid.InvocationFuture<java.util.List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit, QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist)
The query starts from the anchor (excluded) to toTime based on the direction parameter. The result of messages in a limit number is returned.
The query scope is determined by toTime and limit. The parameter that applies first is prioritized. For example, if the messages sent or received between the anchor and toTime is greater than the limit number, the limit number of messages are returned. If less than the limit number, the actual number of messages are returned.
The returned result may have a smaller size than the limit.
anchor
- The start time. A value of null is not allowed. MessageBuilder.createEmptyMessage(String, SessionTypeEnum, long)
.toTime
- The end time in millisecondslimit
- The upper limit of the returned messages (100)direction
- The query direction. QUERY_OLD: desceding order; QUERY_NEW: ascending order.msgTypes
- Message types in an array. Message types, 0: text; 1: image; 2: audio; 3: video; 4: location; 5: notification; 6: file; 10: Tip; 100: custom. Other types are invalid.persist
- Specify whether to persist the result to the local database.InvocationFuture<java.util.List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit, QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist, boolean persistClear)
The query starts from the anchor (excluded) to toTime based on the direction parameter. The result of messages in a limit number is returned.
The query scope is determined by toTime and limit. The parameter that applies first is prioritized. For example, if the messages sent or received between the anchor and toTime is greater than the limit number, the limit number of messages are returned. If less than the limit number, the actual number of messages are returned.
The returned result may have a smaller size than the limit.
anchor
- The start time. A value of null is not allowed. MessageBuilder.createEmptyMessage(String, SessionTypeEnum, long)
.toTime
- The end time in millisecondslimit
- The upper limit of the returned messages (100)direction
- The query direction. QUERY_OLD: desceding order; QUERY_NEW: ascending order.msgTypes
- Message types in an array. Message types, 0: text; 1: image; 2: audio; 3: video; 4: location; 5: notification; 6: file; 10: Tip; 100: custom. Other types are invalid.persist
- Specify whether to store roaming messages obtained using the interface to the local database.persistClear
- Specify whether to persist the messages before clearing to the local storage. The setting applies when persist is set to true.InvocationFuture<java.util.List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit, QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist, boolean persistClear, IMMessageFilter customFilter)
The query starts from the anchor (excluded) to toTime based on the direction parameter. The result of messages in a limit number is returned.
The query scope is determined by toTime and limit. The parameter that applies first is prioritized. For example, if the messages sent or received between the anchor and toTime is greater than the limit number, the limit number of messages are returned. If less than the limit number, the actual number of messages are returned.
The returned result may have a smaller size than the limit.
anchor
- The start time. A value of null is not allowed. MessageBuilder.createEmptyMessage(String, SessionTypeEnum, long)
.toTime
- The end time in millisecondslimit
- The upper limit of the returned messages (100)direction
- The query direction. QUERY_OLD: desceding order; QUERY_NEW: ascending order.msgTypes
- Message types in an array. Message types, 0: text; 1: image; 2: audio; 3: video; 4: location; 5: notification; 6: file; 10: Tip; 100: custom. Other types are invalid.persist
- Specify whether to store roaming messages obtained using the interface to the local database.persistClear
- Specify whether to persist the messages before clearing to the local storage. The setting applies when persist is set to true.customFilter
- The custom filter. If true is returned, ignore the filter. In this case, the message is not pulled.InvocationFuture<java.util.List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit, QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist, boolean persistClear, IMMessageFilter customFilter, boolean updateUnread)
The query starts from the anchor (excluded) to toTime based on the direction parameter. The result of messages in a limit number is returned.
The query scope is determined by toTime and limit. The parameter that applies first is prioritized. For example, if the messages sent or received between the anchor and toTime is greater than the limit number, the limit number of messages are returned. If less than the limit number, the actual number of messages are returned.
The returned result may have a smaller size than the limit.
anchor
- The start time. A value of null is not allowed. MessageBuilder.createEmptyMessage(String, SessionTypeEnum, long)
.toTime
- The end time in millisecondslimit
- The upper limit of the returned messages (100)direction
- The query direction. QUERY_OLD: desceding order; QUERY_NEW: ascending order.msgTypes
- Message types in an array. Message types, 0: text; 1: image; 2: audio; 3: video; 4: location; 5: notification; 6: file; 10: Tip; 100: custom. Other types are invalid.persist
- Specify whether to store roaming messages obtained using the interface to the local database.persistClear
- Specify whether to persist the messages before clearing to the local storage. The setting applies when persist is set to true.customFilter
- The custom filter. If true is returned, ignore the filter. In this case, the message is not pulled.updateUnread
- Specified whether to update the unread count.InvocationFuture<java.util.List<IMMessage>> pullMessageHistory(MsgFullKeywordSearchConfig config)
config
- The search configurationInvocationFuture<java.util.List<IMMessage>> pullMessageHistoryOrderByTime(MsgTimingFullKeywordSearchConfig config)
config
- Search configurationInvocationFuture<java.util.List<IMMessage>> searchMessageHistory(java.lang.String keyword, java.util.List<java.lang.String> fromAccounts, IMMessage anchor, int limit)
keyword
- The keyword for searching text messagesfromAccounts
- The accounts that sent or received messages. If the parameter is specified, the messages from the specified accounts are added to the query result even if no matches are hit.anchor
- The anchor for searchlimit
- The limit for the number of messages returned.InvocationFuture<java.util.List<IMMessage>> searchMessageHistory(java.lang.String keyword, java.util.List<java.lang.String> fromAccounts, IMMessage anchor, QueryDirectionEnum direction, int limit)
keyword
- The keyword for searching text messagesfromAccounts
- The accounts that sent or received messages. If the parameter is specified, the messages from the specified accounts are added to the query result even if no matches are hit.anchor
- The anchor for searchdirection
- Query directionlimit
- The limit for the number of messages returned.InvocationFuture<java.util.List<IMMessage>> searchAllMessageHistory(java.lang.String keyword, java.util.List<java.lang.String> fromAccounts, long time, int limit)
keyword
- The keyword for searching text messagesfromAccounts
- The accounts that sent or received messages. If the parameter is specified, the messages from the specified accounts are added to the query result even if no matches are hit.time
- the time for search.limit
- The limit for the number of messages returned.InvocationFuture<java.util.List<IMMessage>> searchMessage(SessionTypeEnum sessionType, java.lang.String sessionId, MsgSearchOption option)
sessionType
- Session typesessionId
- Session IDoption
- Search optionInvocationFuture<java.util.List<IMMessage>> searchAllMessage(MsgSearchOption option)
option
- Search optionInvocationFuture<java.util.List<MsgIndexRecord>> searchAllSession(java.lang.String query, int limit)
query
- The strings to be queriedlimit
- The limit of returned messagesjava.util.List<MsgIndexRecord> searchAllSessionBlock(java.lang.String query, int limit)
query
- The strings to be queriedlimit
- The limit of returned messagesInvocationFuture<java.util.List<MsgIndexRecord>> searchSession(java.lang.String query, SessionTypeEnum sessionType, java.lang.String sessionId)
query
- The strings to be queriedsessionType
- The session type (P2P or group)sessionId
- the session IDjava.util.List<MsgIndexRecord> searchSessionBlock(java.lang.String query, SessionTypeEnum sessionType, java.lang.String sessionId)
query
- The strings to be queriedsessionType
- The session type (P2P or group)sessionId
- the session IDvoid deleteChattingHistory(IMMessage message)
message
- The message to be deletedvoid deleteChattingHistory(IMMessage message, boolean ignore)
message
- The message to be deletedignore
- true: The clear operation is not recorded locally; false: Record the delete operation locally
If the messages are retrieved from the cloud, the local delete operation will not recorded in the database.
The delete tag will be overwriten by the clear tagvoid deleteChattingHistory(java.util.List<IMMessage> msgList, boolean ignore)
msgList
- The messages to be deleted.ignore
- true: The clear operation is not recorded locally; false: Record the delete operation locally
If the messages are retrieved from the cloud, the local delete operation will not recorded in the database.
The delete tag will be overwriten by the clear tagvoid clearChattingHistory(java.lang.String account, SessionTypeEnum sessionType)
account
- the specified accountsessionType
- Session typevoid clearChattingHistory(java.lang.String account, SessionTypeEnum sessionType, boolean ignore)
account
- the specified accountsessionType
- Session typeignore
- true: The clear operation is not recorded locally; false: record the clear operation. For information about the functionality of a clear operation, seepullMessageHistory(IMMessage, int, boolean, boolean)
InvocationFuture<java.lang.Void> clearMsgDatabase(boolean clearRecent)
MsgServiceObserve.observeRecentContactDeleted(Observer, boolean)
will be triggered.clearRecent
- If the value is set to true, the recent contacts list is also cleared.InvocationFuture<java.lang.Long> deleteMsgSelf(IMMessage msg, java.lang.String ext)
msg
- The message to be deletedext
- extension fieldInvocationFuture<java.lang.Long> deleteMsgSelf(java.util.List<IMMessage> msgList, java.lang.String ext)
msgList
- The messages to be deleted.ext
- extension fieldboolean everBeenDeleted(IMMessage message)
message
- The message to be queriedvoid setChattingAccount(java.lang.String account, SessionTypeEnum sessionType)
clearUnreadCount(String, SessionTypeEnum)
to reset the unread count of the current chat to 0account,
- The peer account or the following to values:MSG_CHATTING_ACCOUNT_ALL
MSG_CHATTING_ACCOUNT_NONE
sessionType
- Session type If the account is not specified, ignore this parameter.int getTotalUnreadCount()
int getTotalUnreadCount(boolean notify)
notify
- true: the count of all unread messages excluding the Do-Not-Disturb messages is returned. False: The acount of the Do-Not-Disturb messages is returned.InvocationFuture<java.util.List<IMMessage>> queryUnreadMessageList(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session IDsessionType
- Session typejava.util.List<IMMessage> queryUnreadMessageListBlock(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session IDsessionType
- Session typeInvocationFuture<java.lang.Void> clearUnreadCount(java.lang.String account, SessionTypeEnum sessionType)
MsgServiceObserve.observeRecentContact(Observer, boolean)
notificationsaccount
- The peer accountsessionType
- Session typeInvocationFuture<java.util.List<SessionAckInfo>> clearUnreadCount(java.util.List<<any>> sessionKeyList)
MsgServiceObserve.observeRecentContact(Observer, boolean)
notificationssessionKeyList
- The accounts in the chats. Pair
includes the session ID and type.
SessionTypeEnum.P2P
and SessionTypeEnum.Team
are supported types.void clearAllUnreadCount()
MsgServiceObserve.observeRecentContact(Observer, boolean)
notificationsInvocationFuture<java.lang.Void> sendMessageReceipt(java.lang.String sessionId, IMMessage message)
sessionId
- Session IDmessage
- P2P read messagesvoid updateIMMessageStatus(IMMessage message)
IMMessage.getStatus()
. Update the status if null is not setIMMessage.getAttachStatus()
. Update the status if null is not setIMMessage.getAttachment()
. Update the status if null is not setmessage
- Message to be updatedvoid updateIMMessage(IMMessage message)
message
- Message to be updatedvoid registerCustomAttachmentParser(MsgAttachmentParser customParser)
MsgTypeEnum.custom
customParser
- Attachment parserInvocationFuture<java.lang.Void> sendCustomNotification(CustomNotification notification)
notification
- The instruction messageInvocationFuture<java.util.List<RecentContact>> queryRecentContacts()
java.util.List<RecentContact> queryRecentContactsBlock()
InvocationFuture<java.util.List<RecentContact>> queryRecentContacts(int limit)
limit
- The upper limit of the local sessions. Up to 100 sessions are allowed. If the number of sessions exceeds 100, 100 will be applied.InvocationFuture<java.util.List<RecentContact>> queryRecentContacts(RecentContact anchor, QueryDirectionEnum direction, int limit)
anchor
- The anchor used to query the recent contacts list.
Pass in null for the first time;
If the direction is set to QUERY_NEW, the query starts from a time of 0;
If the direction is set to QUERY_OLD, the query starts from the current system time.
To go to the next page, pass in the value of RecentContact of the previous page.direction
- Query direction
QUERY_OLD: query data before the anchor and display the result in descending order.
QUERY_NEW: query data after the anchor and display the result in ascending order.limit
- The limit of local sessions
A maximum of 100 sessions are allowed. If the number of sessions exceeds 100, 100 applies.java.util.List<RecentContact> queryRecentContactsBlock(int limit)
limit
- The upper limit of the local sessions. Up to 100 sessions are allowed. If the number of sessions exceeds 100, 100 will be applied.java.util.List<RecentContact> queryRecentContactsBlock(RecentContact anchor, QueryDirectionEnum direction, int limit)
anchor
- The anchor used to query the recent contacts list.
Pass in null for the first time;
If the direction is set to QUERY_NEW, the query starts from a time of 0;
If the direction is set to QUERY_OLD, the query starts from the current system time.
To go to the next page, pass in the value of RecentContact of the previous page.direction
- Query direction
QUERY_OLD: query data before queryTime and display the result in descending order.
QUERY_NEW: query data after queryTime and display the result in ascending order.limit
- The limit of local sessions
A maximum of 100 sessions are allowed. If the number of sessions exceeds 100, 100 applies.InvocationFuture<java.util.List<RecentContact>> queryRecentContacts(MsgTypeEnum filterMsgType)
filterMsgType
- The filted typesjava.util.List<RecentContact> queryRecentContactsBlock(MsgTypeEnum filterMsgType)
filterMsgType
- The filted typesInvocationFuture<java.util.List<RecentContact>> queryRecentContacts(java.util.Set<MsgTypeEnum> filterMsgTypeSet)
filterMsgTypeSet
- The filtered type of messagesjava.util.List<RecentContact> queryRecentContactsBlock(java.util.Set<MsgTypeEnum> filterMsgTypeSet)
filterMsgTypeSet
- The filtered type of messagesvoid updateRecent(RecentContact recent)
MsgServiceObserve.observeRecentContact(Observer, boolean)
, use updateRecentAndNotify(RecentContact)
recent
- The recent contact to be updatedvoid updateRecentAndNotify(RecentContact recent)
MsgServiceObserve.observeRecentContact(Observer, boolean)
. updateRecent(RecentContact)
. recent
- The recent contact to be updated.void updateRecentByMessage(IMMessage message, boolean needNotify)
message
- The messageneedNotify
- Specify whether to trigger MsgServiceObserve.observeRecentContact(Observer, boolean)
.void updateRoamMsgHasMoreTag(IMMessage newTag)
newTag
- The session ID, session type, service ID, and message sent time are required.void deleteRecentContact(RecentContact recent)
recent
- The recent contact sessionvoid deleteRecentContact2(java.lang.String account, SessionTypeEnum sessionType)
MsgServiceObserve.observeRecentContactDeleted(Observer, boolean)
to send a notification.account
- sessionType
- InvocationFuture<java.lang.Void> deleteRoamingRecentContact(java.lang.String contactId, SessionTypeEnum sessionTypeEnum)
contactId
- Contact ID (account or group ID)sessionTypeEnum
- Session typeInvocationFuture<java.lang.Void> deleteRecentContact(java.lang.String account, SessionTypeEnum sessionType, DeleteTypeEnum deleteType, boolean sendAck)
MsgServiceObserve.observeRecentContactDeleted(Observer, boolean)
to send a notification.account
- the specified accountsessionType
- Session type. SessionTypeEnum.P2P
and SessionTypeEnum.Team
. Roaming messages will be deleted.deleteType
- Specify to delete local messages or roaming messages.
A value of null will take DeleteTypeEnum.REMAIN
sendAck
- Specify whether to tag the session as read for other devices.void deleteRoamMsgHasMoreTag(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session IDsessionType
- Session typeAbortableFuture<java.lang.String> transVoiceToText(java.lang.String voiceUrl, java.lang.String path, long duration)
voiceUrl
- Voice url. Optional If no URL exist, the SDK automatically upload the voice to NOS buckets.path
- Voice path to get the sampling rate of the voice. Make sure the audio is downloaded to the local storage.duration
- The duration of an audio file.AbortableFuture<java.lang.String> transVoiceToTextAtScene(java.lang.String voiceUrl, java.lang.String path, long duration, java.lang.String sceneKey)
voiceUrl
- Voice url. Optional If no URL exist, the SDK automatically upload the voice to NOS buckets.path
- Voice path to get the sampling rate of the voice. Make sure the audio is downloaded to the local storage.duration
- The duration of an audio file.sceneKey
- The NOS sceneKey for uploads. Default value: NimNosSceneKeyConstant#NIM_DEFAULT_IM
. For information about how to configure NOS token scene, seeNosTokenSceneConfig
.AbortableFuture<java.lang.String> transVoiceToTextEnableForce(java.lang.String voiceUrl, java.lang.String path, long duration, java.lang.String sceneKey, boolean enableForceUploadFile)
voiceUrl
- Voice URL Optional If no URL exist, the SDK automatically upload the voice to NOS buckets.path
- Voice path to get the sampling rate of the voice. Make sure the audio is downloaded to the local storage.duration
- The duration of an audio file.sceneKey
- The NOS sceneKey for uploads. Default value: NimNosSceneKeyConstant#NIM_DEFAULT_IM
. For information about how to configure NOS token scene, seeNosTokenSceneConfig
.enableForceUploadFile
- The option to specify whether to forcibly resume uploads. The default value is false.InvocationFuture<java.util.ArrayList<IMMessage>> searchRoamingMsg(java.lang.String otherAccid, long fromTime, long endTime, java.lang.String keyword, int limit, boolean reverse)
otherAccid
- peer accountfromTime
- The start time in millisecondsendTime
- The end time in millisecondskeyword
- Keywordslimit
- The limit of messages returned from a query. A maximum of 100 messages are returned.reverse
- Optional. If the parameter is not specified, false is used by default. A value of true implements a reverse search that starts from the earliest to date and display the result in descending order. The default value is false, which indicates that the search starts from the current date to the earliest time and displays the result in ascending ordervoid registerIMMessageFilter(IMMessageFilter filter)
filter
- Notification filter in the upper layer. The parameter allows users to filter messages not to store messages in the database. A value of null can unregister the message filter.void registerShouldShowNotificationWhenRevokeFilter(ShowNotificationWhenRevokeFilter filter)
InvocationFuture<java.lang.Void> revokeMessage(IMMessage message)
revokeMessageEx(IMMessage, String, Map)
message
- The message to be recalled.InvocationFuture<java.lang.Void> revokeMessageEx(IMMessage message, java.lang.String customApnsText, java.util.Map<java.lang.String,java.lang.Object> pushPayload)
NIMClient.toggleRevokeMessageNotification(boolean on)
message
- The message to be recalled.customApnsText
- Custom push text. If the parameter is not specified, no push notifications will be sent.pushPayload
- Custom push payload in JSON format with a maximum of 2048 characters.InvocationFuture<java.lang.Void> revokeMessage(IMMessage message, java.lang.String customApnsText, java.util.Map<java.lang.String,java.lang.Object> pushPayload, boolean shouldNotifyBeCount)
NIMClient.toggleRevokeMessageNotification(boolean on)
message
- The message to be recalled.customApnsText
- Custom push text. If the parameter is not specified, no push notifications will be sent.pushPayload
- Custom push payload in JSON format with a maximum of 2048 characters.shouldNotifyBeCount
- Specify whether to update the unread count when a message is recalled.InvocationFuture<java.lang.Void> revokeMessage(IMMessage message, java.lang.String customApnsText, java.util.Map<java.lang.String,java.lang.Object> pushPayload, boolean shouldNotifyBeCount, java.lang.String postscript)
NIMClient.toggleRevokeMessageNotification(boolean on)
message
- The message to be recalled.customApnsText
- Custom push text. If the parameter is not specified, no push notifications will be sent.pushPayload
- Custom push payload in JSON format with a maximum of 2048 characters.shouldNotifyBeCount
- Specify whether to update the unread count when a message is recalled.postscript
- Additional messageInvocationFuture<java.lang.Void> revokeMessage(IMMessage message, java.lang.String customApnsText, java.util.Map<java.lang.String,java.lang.Object> pushPayload, boolean shouldNotifyBeCount, java.lang.String postscript, java.lang.String attach)
NIMClient.toggleRevokeMessageNotification(boolean on)
message
- The message to be recalled.customApnsText
- Custom push text. If the parameter is not specified, no push notifications will be sent.pushPayload
- Custom push payload in JSON format with a maximum of 2048 characters.shouldNotifyBeCount
- Specify whether to update the unread count when a message is recalled.postscript
- Additional messageattach
- extension fieldInvocationFuture<java.lang.Void> importRecentSessions(java.util.List<<any>> sessions)
sessions
- LocalAntiSpamResult checkLocalAntiSpam(java.lang.String content, java.lang.String replacement)
content
- The text for checkreplacement
- Replacement for hitsRecentContact createEmptyRecentContact(java.lang.String contactId, SessionTypeEnum sessionType, long tag, long time, boolean saveToDB)
contactId
- Contact ID, peer account or group IDsessionType
- Session typetag
- Session tag. For example, Pinned tag implemented in UIKit: RECENT_TAG_STICKY. You can use a custom tag or pass in 0 if not required. time
- The time of a session in millisecondssaveToDB
- Specify whether to store the session in the database. Note: MsgServiceObserve.observeRecentContact(Observer, boolean)
will be triggered.
RecentContact createEmptyRecentContact(java.lang.String contactId, SessionTypeEnum sessionType, long tag, long time, boolean saveToDB, boolean withLastMsg)
contactId
- Contact ID, peer account or group IDsessionType
- Session typetag
- Session tag. For example, Pinned tag implemented in UIKit: RECENT_TAG_STICKY. You can use a custom tag or pass in 0 if not required. time
- The time of a session in millisecondssaveToDB
- Specify whether to store the session in the database. Note: MsgServiceObserve.observeRecentContact(Observer, boolean)
will be triggered.
withLastMsg
- Specify whether to include the most recent message.RecentContact queryRecentContact(java.lang.String contactId, SessionTypeEnum sessionType)
contactId
- Contact ID, peer account or group IDsessionType
- Session typeInvocationFuture<java.lang.Void> cancelUploadAttachment(IMMessage imMessage)
MsgStatusEnum.fail
and the attachment @link AttachStatusEnum#cancel}imMessage
- The message whose attachment upload is cancelled.AbortableFuture<java.lang.Void> exportAllMessage(IMsgExportProcessor exportProcessor, boolean safeMode)
importAllMessage(IMsgImportProcessor, boolean safeMode)
MigrationConstant.EXPORT_ERR_DB_EMPTY
MigrationConstant.EXPORT_ERR_LOCAL_FORMAT
MigrationConstant.EXPORT_ERR_USER_CUSTOM_ZIP
MigrationConstant.EXPORT_ERR_USER_CUSTOM_ENCRYPT
MigrationConstant.EXPORT_ERR_UPLOAD_FILE
MigrationConstant.EXPORT_ERR_EMPTY_AFTER_FILTER
exportProcessor
- The Export processer. This parameter is required.safeMode
- Enable or disable the safe mode.. In the safe mode, the file will be deleted after export, including user defined files.AbortableFuture<java.lang.Void> importAllMessage(IMsgImportProcessor iMsgImportProcessor, boolean safeMode)
exportAllMessage(IMsgExportProcessor, boolean safeMode)
Procedure to import messages:
Step 1. Send a request to download the backup file.
Step 2. Decrypt the downloaded file. Developers can define the process.
Step3. Decompress the downloaded file. Developers can define the process.
Step4. Parse the file.
Error code:
No backup is stored on the server: MigrationConstant.IMPORT_ERR_NO_BACKUP
An empty backup is returned: MigrationConstant.IMPORT_ERR_RECORD_EMPTY
Download failed: MigrationConstant.IMPORT_ERR_DOWN_FILE
Failed to decrypt the backup file (developer-defined process): MigrationConstant.IMPORT_ERR_CUSTOM_DECRYPT
Failed to decompress the backup file (developer-defined process): MigrationConstant.IMPORT_ERR_CUSTOM_UNZIP
Invalid file format: MigrationConstant.IMPORT_ERR_FILE_FORMAT
Part of messages are imported: MigrationConstant.IMPORT_ERR_PART_SUCCESS
iMsgImportProcessor
- The import processer. The parameter is required.safeMode
- Enable or disable the safe mode.. In the safe mode, the file will be deleted after import, including user defined files.void clearServerHistory(java.lang.String sessionId, boolean deleteRoam)
sessionId
- Session IDdeleteRoam
- Specify whether to delete roaming messages.void clearServerHistory(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session IDsessionType
- Session typevoid clearServerHistory(java.lang.String sessionId, SessionTypeEnum sessionType, boolean deleteRoam)
clearServerHistory(String, boolean)
To delete roaming messages, use clearServerHistory(String, SessionTypeEnum)
sessionId
- Session IDsessionType
- Session typedeleteRoam
- Specify whether to delete roaming messages.void clearServerHistory(java.lang.String sessionId, SessionTypeEnum sessionType, boolean sync, java.lang.String ext)
sessionId
- Session IDsessionType
- Session typesync
- Enable or disable sync states with other devicesext
- Extension fieldvoid deleteRangeHistory(java.lang.String account, SessionTypeEnum sessionType, long startTime, long endTime)
account
- Account under which messages are deletedsessionType
- Session typestartTime
- Start timeendTime
- End timeInvocationFuture<RecentSessionList> queryMySessionList(long minTimestamp, java.lang.Long maxTimestamp, java.lang.Integer needLastMsg, java.lang.Integer limit, java.lang.Integer hasMore)
minTimestamp
- The minimum timestamp as the increment used as request parameter to get the session list. A value of 0 indicates all sessions are retrieved.maxTimestamp
- The maximum timestamp paginationneedLastMsg
- Specify whether to get lastMsg. 0 or 1. The default value is 1.limit
- The limit of retrieved sessions. A maximum of 100 sessions are supported. The default value is 100.hasMore
- ReservedqueryMySessionList(QueryMySessionOption)
InvocationFuture<RecentSessionList> queryMySessionList(QueryMySessionOption option)
option
- Options for configurationInvocationFuture<RecentSession> queryMySession(java.lang.String sessionId)
sessionIdArr
- P2P, team or superTeam. Format: p2p|accid, team|tid, or super_team|tidcom.netease.nimlib.biz.constant.ITalkService.SessionTag
InvocationFuture<java.lang.Void> updateMySession(java.lang.String sessionId, java.lang.String ext)
sessionIdArr
- P2P, team or superTeam. Format: p2p|accid, team|tid, or super_team|tidext
- extension field. Visible for the current user.com.netease.nimlib.biz.constant.ITalkService.SessionTag
InvocationFuture<java.lang.Void> deleteMySession(java.lang.String[] sessionIdArr)
sessionIdArr
- P2P, team or superTeam. Format: p2p|accid, team|tid, or super_team|tid.com.netease.nimlib.biz.constant.ITalkService.SessionTag
InvocationFuture<ThreadTalkHistory> queryThreadTalkHistory(IMMessage anchor, long fromTime, long toTime, int limit, QueryDirectionEnum direction, boolean persist)
anchor
- The search anchor. The search object is the messages in a thread.fromTime
- The start timetoTime
- The end timelimit
- The limit of messagesdirection
- Search directionpersist
- Specify whether to persist the resultint queryReplyCountInThreadTalkBlock(IMMessage msg)
msg
- A message in a threadInvocationFuture<java.lang.Void> addQuickComment(IMMessage msg, long replyType, java.lang.String ext)
msg
- the message object to be repliedreplyType
- Reply typeext
- Extension field that can hold up to 8 charactersInvocationFuture<java.lang.Long> addQuickComment(IMMessage msg, long replyType, java.lang.String ext, boolean needPush, boolean needBadge, java.lang.String pushTitle, java.lang.String pushContent, java.util.Map<java.lang.String,java.lang.Object> pushPayload)
msg
- the message object to be repliedreplyType
- Reply typeext
- Extension field that can hold up to 8 charactersneedPush
- Enable or disable pushneedBadge
- Hide or show the message badgepushTitle
- The title of a push notificationpushContent
- The content of a push notificationpushPayload
- Custom push property in JSON format onlyInvocationFuture<java.lang.Void> removeQuickComment(IMMessage msg, long replyType, java.lang.String ext)
msg
- the message object to be repliedreplyType
- Reply typeext
- Extension field that can hold up to 8 charactersInvocationFuture<java.lang.Long> removeQuickComment(IMMessage msg, long replyType, java.lang.String ext, boolean needPush, boolean needBadge, java.lang.String pushTitle, java.lang.String pushContent, java.util.Map<java.lang.String,java.lang.Object> pushPayload)
msg
- the message object to be repliedreplyType
- Reply typeext
- Extension field that can hold up to 8 charactersneedPush
- Enable or disable pushneedBadge
- Hide or show the message badgepushTitle
- The title of a push notificationpushContent
- The content of a push notificationpushPayload
- Custom push property in JSON format onlyInvocationFuture<java.util.List<QuickCommentOptionWrapper>> queryQuickComment(java.util.List<IMMessage> msgList)
msgList
- A list of messages for quick comments. Up to 20 messages are supported.InvocationFuture<CollectInfo> addCollect(int type, java.lang.String date, java.lang.String ext, java.lang.String uniqueId)
type
- Bookmark typedate
- Time when the bookmark is collectedext
- extension fielduniqueId
- The unique IDInvocationFuture<java.lang.Integer> removeCollect(java.util.List<<any>> collectInfo)
collectInfo
- Info of bookmarks to be removed. Each pair consists of a bookmark ID and the creation time.CollectInfo
InvocationFuture<CollectInfo> updateCollect(CollectInfo info, java.lang.String ext)
info
- The bookmarks to be updatedext
- The extension fieldInvocationFuture<CollectInfo> updateCollect(long infoId, long createTime, java.lang.String ext)
infoId
- The ID of a bookmark to be updatedcreateTime
- The creation time of a bookmark to be updatedext
- The extension fieldInvocationFuture<CollectInfoPage> queryCollect(int limit)
limit
- The limit of messages returned from a query. A maximum of 100 messages are returned.InvocationFuture<CollectInfoPage> queryCollect(CollectInfo anchor, long toTime, int limit, QueryDirectionEnum direction)
anchor
- The last bookmark in the query excluded in the query result.toTime
- The end time in millisecondslimit
- The limit of messages returned from a query. A maximum of 100 messages are returned.direction
- Query directionInvocationFuture<CollectInfoPage> queryCollect(CollectInfo anchor, long toTime, int limit, QueryDirectionEnum direction, int type, boolean persist)
anchor
- The last bookmark in the query excluded in the query result.toTime
- The end time in millisecondslimit
- The limit of messages returned from a query. A maximum of 100 messages are returned.direction
- Query directiontype
- Bookmark typepersist
- Specify whether to persist the resultInvocationFuture<java.lang.Long> addMsgPin(IMMessage msg, java.lang.String ext)
msg
- PIN messageext
- extension fieldInvocationFuture<java.lang.Long> updateMsgPin(IMMessage msg, java.lang.String ext)
msg
- PIN messageext
- extension fieldInvocationFuture<java.lang.Long> removeMsgPin(IMMessage msg, java.lang.String ext)
msg
- PIN messageext
- extension fieldInvocationFuture<MsgPinSyncResponseOptionWrapper> syncMsgPin(SessionTypeEnum sessionType, java.lang.String sessionId, long timestamp)
sessionType
- Session typesessionId
- Session IDtimestamp
- A timestamp. Sync PIN messages after the timestamp.java.util.List<MsgPinDbOption> queryMsgPinBlock(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session IDsessionType
- Session typeInvocationFuture<StickTopSessionInfo> addStickTopSession(java.lang.String sessionId, SessionTypeEnum sessionType, java.lang.String ext)
sessionId
- Session IDsessionType
- Session typeext
- The extension field. A maximum of 512 characters are allowed.InvocationFuture<java.lang.Void> removeStickTopSession(java.lang.String sessionId, SessionTypeEnum sessionType, java.lang.String ext)
sessionId
- Session IDsessionType
- Session typeext
- The extension field. A maximum of 512 characters are allowed.InvocationFuture<StickTopSessionInfo> updateStickTopSession(java.lang.String sessionId, SessionTypeEnum sessionType, java.lang.String ext)
sessionId
- Session IDsessionType
- Session typeext
- The extension field. A maximum of 512 characters are allowed.java.util.List<StickTopSessionInfo> queryStickTopSessionBlock()
boolean isStickTopSession(java.lang.String sessionId, SessionTypeEnum sessionType)
sessionId
- Session ID. A value of "” or null returns false.sessionType
- Session type. A value of null returns falsevoid migrateMessages(java.lang.String from, java.lang.String to, boolean changeFrom)
from
- Account from which the message data is migratedto
- Account to which the message data is migrated.changeFrom
- Specify whether to change the fromAccount parameter of IMMessage in the source data. If the value is set to true, fromAccount is changed from the value of from to a value of to