Class NativeClient
-
- All Implemented Interfaces:
public final class NativeClient
IM 客户端核心类。
所有 IM 相关方法、监听器都由此调用和设置。
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description public final NativeObject
nativeObj
public String
deviceId
public NativeClient.IPCMessageInterceptor
messageInterceptor
-
Method Summary
Modifier and Type Method Description NativeObject
getNativeObj()
String
getDeviceId()
NativeClient.IPCMessageInterceptor
getMessageInterceptor()
void
setMessageInterceptor(NativeClient.IPCMessageInterceptor listener)
设置 IPC 进程消息拦截器 此拦截器必须在 IPC 进程设置 static NativeClient
getInstance()
static Context
getApplicationContext()
static ThreadFactory
threadFactory(String name, boolean daemon)
void
setIsInBackground(boolean isInBackground)
NativeObject.Message
transformMessage(Message msg)
void
init(Context context, String appKey, String deviceId, RCConfiguration configuration, String soDir)
初始化 SDK。 void
initAppendixModule()
初始化非主要的模块 void
registerMessageType(Class<out MessageContent> msgType)
注册消息类型,如果对消息类型进行扩展,可以忽略此方法。 void
registerMessageType(List<Class<out MessageContent>> msgTypeList)
批量注册消息类型,如果对消息类型进行扩展,可以忽略此方法。 void
disconnect()
断开连接(默认断开后接收Push消息)。 void
disconnect(boolean isReceivePush)
断开连接。 void
getConversationList(String channelId, IProgressResultCallback callback)
获取会话列表。 会话列表按照时间从前往后排列,如果有置顶会话,则置顶会话在前。 void
getConversationList(Array<int> conversationTypeValues, String channelId, IProgressResultCallback callback)
根据 conversation 数组 获取对应对会话列表 MessageContent
renderMessageContent(String objectName, Array<byte> content, Message message)
MessageContent
newMessageContent(String objectName, Array<byte> content)
MessageHandler<? extends MessageContent>
getMessageHandler(String objectName)
List<Conversation>
getConversationList(Array<int> conversationTypeValues)
根据 conversation 数组 获取对应对会话列表 void
getBlockedConversationList(Array<int> conversationTypes, String channelId, IProgressResultCallback callback)
void
getTopConversationList(Array<int> conversationTypes, String channelId, IProgressResultCallback callback)
获取置顶会话列表 void
getUnreadConversationList(Array<int> conversationTypeValues, IProgressResultCallback callback)
根据 conversation 数组 获取对应对的未读会话列表 void
getConversationListByPage(Array<int> conversationTypeValues, long timeStamp, int count, String channelId, IProgressResultCallback callback)
分页获取会话列表 void
getInfoForConversations(Array<String> targetIds, IProgressResultCallback callback)
根据超级群的TargetId数组,获取每个超级群下所有频道的会话未读信息 void
getConversation(ConversationType conversationType, String targetId, String channelId, IResultCallback callback)
获取某一会话信息。 void
removeConversation(ConversationType conversationType, String tId, String channelId, IBooleanCallback callback)
从会话列表中移除某一会话,但是不删除会话内的消息。 如果此会话中有新的消息,该会话将重新在会话列表中显示,并显示最近的历史消息。 void
removeConversations(List<ConversationIdentifier> conversationIdentifierList, IBooleanCallback callback)
批量从会话列表中移除会话,但是不删除会话内的消息。 如果此会话中有新的消息,该会话将重新在会话列表中显示,并显示最近的历史消息。 void
setConversationToTop(ConversationType conversationType, String targetId, String channelId, boolean isTop, boolean needCreate, IBooleanCallback callback)
设置某一会话为置顶或者取消置顶。 void
setConversationsToTop(List<ConversationIdentifier> conversationIdentifierList, boolean isTop, boolean needCreate, IBooleanCallback callback)
批量设置会话为置顶或者取消置顶。 boolean
createEncryptedConversation(String targetId, RCEncryptedSession chatInfo)
创建加密会话 RCEncryptedSession
getEncryptedConversation(String targetId)
获取加密会话 List<RCEncryptedSession>
getAllEncryptedConversations()
获取本地所有加密会话信息 boolean
setEncryptedConversation(String targetId, RCEncryptedSession chatInfo)
更新targetId对应的Conversation。 boolean
removeEncryptedConversation(String targetId)
删除对应targetId的加密会话 boolean
clearEncryptedConversations()
清除所有的加密会话。 void
getTotalUnreadCount(String channelId, boolean containBlocked, IIntegerCallback callback)
获取所有未读消息数。 void
getUnreadCount(ConversationType conversationType, String targetId, String channelId, IIntegerCallback callback)
获取来自某用户(某会话)的未读消息数。 void
getMessageCount(ConversationType conversationType, String targetId, String channelId, IIntegerCallback callback)
获取来自某用户(某会话)的消息总数。 void
getTotalUnreadCount(Array<Conversation> conversations, IIntegerCallback callback)
获取指定会话的总未读消息数 void
getUnreadCount(String channelId, Array<ConversationType> conversationTypes, IIntegerCallback callback)
获取某会话类型的未读消息数. void
getUnreadCount(String channelId, boolean withDND, Array<ConversationType> conversationTypes, IIntegerCallback callback)
获取某会话类型的未读消息数. void
getLatestMessages(ConversationType conversationType, String targetId, String channelId, int count, IProgressResultCallback callback)
获取最新消息记录。 void
getHistoryMessages(ConversationType conversationType, String targetId, String channelId, long oldestMessageId, int count, IProgressResultCallback callback)
获取历史消息记录。 List<Message>
getHistoryMessages(ConversationType conversationType, String targetId, String channelId, String objectName, long oldestMessageId, int count)
获取历史消息记录。 void
getHistoryMessages(ConversationType conversationType, String targetId, String channelId, String objectName, long oldestMessageId, int count, boolean direction, IProgressResultCallback callback)
根据会话类型的目标 Id,回调方式获取某消息类型的某条消息之前或之后的N条历史消息记录。如: 要获取messageId为22的之前的10条图片消息, 则相应参数为 getHistoryMessages(conversationType, targetId, "RC:ImgMsg", 22, 10, true, resultCallback)。 注意:返回的消息列表里面不包含oldestMessageId本身。 void
getHistoryMessages(ConversationType conversationType, String targetId, String channelId, List<String> objectNames, long timestamp, int count, boolean direction, IProgressResultCallback callback)
根据会话类型的目标 Id,回调方式获取某些消息类型的某条消息之前或之后的N条历史消息记录。如: 要获取 messageId
为22的之前的10条图片消息和文字消息List<String> objectNames = new ArrayList<>(); objectNames.add("RC:ImgMsg"); objectNames.add("RC:TxtMsg"); 则相应参数为 getHistoryMessages(conversationType, targetId, "RC:ImgMsg", 22, 10, true, resultCallback)。 注意:返回的消息列表里面不包含oldestMessageId本身。
void
getMessages(ConversationType conversationType, String targetId, String channelId, long timestamp, int count, boolean direction, IProgressResultCallback callback)
根据会话类型的目标 Id,回调方式获取某些消息类型的某条消息之前或之后的N条历史消息记录。如: 要获取 messageId
为22的之前的10条图片消息和文字消息List<String> objectNames = new ArrayList<>(); objectNames.add("RC:ImgMsg"); objectNames.add("RC:TxtMsg"); 则相应参数为 getHistoryMessages(conversationType, targetId, "RC:ImgMsg", 22, 10, true, resultCallback)。 注意:返回的消息列表里面不包含oldestMessageId本身。
void
getRemoteHistoryMessages(ConversationType conversationType, String targetId, String channelId, long dataTime, int count, NativeClient.IRemoteMessageResultCallback<List<Message>, Long, Boolean> callback)
获取历史消息记录。 历史消息记录,按照时间顺序从新到旧排列。 void
getRemoteHistoryMessages(ConversationType conversationType, String targetId, String channelId, RemoteHistoryMsgOption remoteHistoryMsgOption, NativeClient.IRemoteMessageResultCallback<List<Message>, Long, Boolean> callback)
获取历史消息记录。 历史消息记录,按照时间顺序从新到旧排列。 void
getBatchLocalMessage(ConversationType conversationType, String targetId, String channelId, List<String> messageUIDs, IProgressResultCallback callback)
void
setPushSetting(int key, String value, NativeClient.IResultCallback<Long> resultCallback)
Push 设置 void
getPushSetting(int key, IStringCallback callback)
获取 Push 设置 boolean
deleteMessages(Array<int> messageIds)
删除指定的一条或者一组消息。 void
deleteMessage(ConversationType conversationType, String targetId, String channelId, IBooleanCallback callback)
清空某一会话的所有聊天消息记录。 void
deleteMessages(ConversationType conversationType, String targetId, String channelId, Array<Message> messages, NativeClient.OperationCallback callback)
删除指定的一条或者一组消息。会同时删除本地和远端消息。 void
clearMessages(ConversationType conversationType, String targetId, String channelId, IBooleanCallback callback)
清空某一会话的所有聊天消息记录。 void
clearMessages(List<ClearMessageOption> clearMessageOptionList, IBooleanCallback callback)
异步批量删除指定会话早于(含)发送时间的所有本地数据库消息。 void
clearRemoteMessages(List<ClearMessageOption> clearMessageOptionList, boolean isDeleteLocal, NativeClient.OperationCallback callback)
批量指定会话按发送时间删除远端消息,同时决定是否连带删除本地消息 void
cleanRemoteHistoryMessages(ConversationType conversationType, String targetId, String channelId, long recordTime, NativeClient.OperationCallback callback)
清空某一会话,某一时间戳之前的聊天历史记录 void
cleanHistoryMessages(ConversationType conversationType, String targetId, String channelId, long recordTime, NativeClient.OperationCallback callback)
清空某一会话,某一时间戳之前的聊天历史记录 void
clearMessagesUnreadStatus(ConversationType conversationType, String targetId, String channelId, IBooleanCallback callback)
清除消息未读状态。 void
setMessageExtra(int messageId, String value, IBooleanCallback callback)
设置消息的附加信息,此信息只保存在本地。 boolean
setMessageReceivedStatus(int messageId, ReceivedStatus receivedStatus)
设置接收到的消息状态。 void
setMessageSentStatus(int messageId, SentStatus sentStatus, IBooleanCallback callback)
设置发送的消息状态。 void
clearTextMessageDraft(ConversationType conversationType, String targetId, String channelId, IBooleanCallback callback)
清除某一会话的文字消息草稿。 void
getTextMessageDraft(ConversationType conversationType, String targetId, String channelId, IStringCallback callback)
获取某一会话的文字消息草稿。 void
saveTextMessageDraft(ConversationType conversationType, String targetId, String channelId, String content, IBooleanCallback callback)
保存文字消息草稿。 void
getMessage(int messageId, IResultCallback callback)
根据 message id 获取 message void
getTopStatus(String targetId, int conversationType, String channelId, IBooleanCallback callback)
void
getUnreadCountByObjectName(String targetId, int conversationType, Array<String> objectNames, String channelId, IIntegerCallback callback)
void
clearMessagesUnreadStatusByTag(String tagId, IBooleanCallback callback)
void
clearConversationsByTag(String tagId, boolean deleteMessage, IBooleanCallback callback)
boolean
hasIPCMessageInterceptor()
void
sendMediaMessage(Message message, String pushContent, String pushData, NativeClient.ISendMediaMessageCallback<Message> mediaMessageCallback)
void
sendMediaMessage(Message message, Array<String> userIds, String pushContent, String pushData, NativeClient.ISendMediaMessageCallback<Message> mediaMessageCallback)
void
sendMediaMessage(Message message, String pushContent, String pushData, SendMessageOption option, NativeClient.ISendMediaMessageCallback<Message> mediaMessageCallback)
void
uploadMedia(Message message, NativeClient.IResultProgressCallback<String> callback)
上传媒体文件。 上传文件。 用来实现自定义消息时,上传消息中的文件内容到服务器。 int
getGIFLimitSize()
int
getVideoLimitTime()
Message
insertSettingMessage(Message message)
模拟消息。 Message
insertSettingMessage(Message message, String msgUid)
模拟消息。 void
downloadMedia(ConversationType conversationType, String targetId, int type, String mediaUrl, NativeClient.IResultProgressCallback<String> callback)
下载文件。 用来获取媒体原文件时调用。如果本地缓存中包含此文件,则从本地缓存中直接获取,否则将从服务器端下载。 void
downloadMediaMessage(Message message, NativeClient.IDownloadMediaMessageCallback<Message> callback)
下载多媒体文件。 用来获取媒体原文件时调用。如果本地缓存中包含此文件,则从本地缓存中直接获取,否则将从服务器端下载。 void
downloadMediaFile(String uid, String fileUrl, String fileName, String path, NativeClient.IDownloadMediaFileCallback<String> callback)
下载多媒体文件。 用来获取媒体原文件时调用。如果本地缓存中包含此文件,则从本地缓存中直接获取,否则将从服务器端下载。 void
getConversationNotificationStatus(ConversationType conversationType, String targetId, String channelId, NativeClient.IResultCallback<Integer> callback)
获取会话消息提醒状态。 void
setConversationNotificationStatus(ConversationType conversationType, String targetId, String channelId, int level, NativeClient.OperationCallback callback)
设置会话消息提醒状态。 void
setOnReceiveMessageListener(NativeClient.OnReceiveMessageListener listener)
设置接收消息的监听器。 所有接收到的消息、通知、状态都经由此处设置的监听器处理。包括私聊消息、讨论组消息、群组消息、聊天室消息以及各种状态。 void
setConnectionStatusListener(NativeClient.ICodeListener listener)
设置连接状态变化的监听器。 long
getDeltaTime()
获取本地时间与服务器时间的差值。 void
clearConversations(String channelId, Array<ConversationType> conversationTypes, IBooleanCallback callback)
清空所有会话及会话消息 void
addToBlacklist(String userId, NativeClient.OperationCallback callback)
将某个用户加到黑名单中。 void
recallMessage(String objectName, Array<byte> content, String pushContent, Message message, NativeClient.OperationCallback callback)
void
removeFromBlacklist(String userId, NativeClient.OperationCallback callback)
将个某用户从黑名单中移出。 void
getBlacklistStatus(String userId, NativeClient.IResultCallback<NativeClient.BlacklistStatus> callback)
获取某用户是否在黑名单中。 void
getBlacklist(IStringCallback callback)
获取当前用户的黑名单列表。 void
setNotificationQuietHours(String startTime, int spanMinutes, int level, NativeClient.OperationCallback callback)
设置会话通知免打扰时间。 void
removeNotificationQuietHours(NativeClient.OperationCallback callback)
移除会话通知免打扰时间。 void
getNotificationQuietHours(NativeClient.GetNotificationQuietHoursCallback callback)
获取会话通知免打扰时间。 void
updateMessageReceiptStatus(String targetId, int categoryId, String channelId, long timestamp, IBooleanCallback callback)
void
clearUnreadByReceipt(int conversationType, String targetId, String channelId, long timestamp, IBooleanCallback callback)
long
getSendTimeByMessageId(int messageId)
void
updateConversationInfo(ConversationType conversationType, String targetId, String channelId, String title, String portrait, IBooleanCallback callback)
void
getVoIPKey(int engineType, String channelName, String extra, NativeClient.IResultCallback<String> callback)
String
getVoIPCallInfo()
boolean
isGzipEnabled()
String
getNavPreferenceValue(String key)
void
requestNav(String appKey, String token, boolean notify)
String
getSaveCacheDir()
Uri
obtainMediaFileSavedUri()
long
getDbLastModified(Context context, String appKey, String userId, String dbName)
String
getDbPath(Context context, String appKey, String userId, String dbName)
void
initHttpDns()
boolean
setMessageContent(int messageId, Array<byte> messageContent, String objectName)
String
getToken()
boolean
isKvStorageEnabled()
boolean
isDnsEnabled()
boolean
unreadCountDroveByServer()
boolean
isGROpened()
void
getUnreadMentionedMessages(ConversationType conversationType, String targetId, String channelId, int count, boolean desc, IProgressResultCallback callback)
void
getOfflineMessageDuration(IStringCallback callback)
void
setOfflineMessageDuration(String duration, NativeClient.IResultCallback<Long> callback)
void
switchAppKey(String appKey, String deviceId)
void
getTheFirstUnreadMessage(int conversationType, String targetId, String channelId, IResultCallback callback)
void
setReconnectKickEnable(boolean enable)
设置是否允许重连时踢人 void
SetPushNotificationListener(NativeClient.PushNotificationListener listener)
void
setConversationStatusListener(NativeObject.ConversationStatusListener listener)
void
setConversationListener(NativeObject.RTConversationListener listener)
void
setUltraGroupEventListener(NativeObject.ReceiveUltraGroupEventListener listener)
String
getCurrentUserId()
获取当前登录用户的 user id String
getRTCProfile()
List<ServerAddressData>
getUploadLogConfigAddressDataList()
获取最近一次导航中上传日志配置信息 List<ServerAddressData>
getStatsAddressDataList()
获取最近一次导航中上传统计服务配置信息 void
updateVoIPCallInfo(String rtcProfile)
void
sdkBackgroundChanged(boolean isInBackground)
void
updateMessageExpansion(Map<String, String> expansion, String messageUId, NativeClient.OperationCallback callback)
Message
getMessageByUid(String uid)
Array<NativeObject.Message>
getMessageByUIds(Array<String> uidArray)
void
sendMessageOption(Message message, String pushContent, String pushData, SendMessageOption option, Array<String> userIds, NativeClient.ISendMessageCallback<Message> callback)
void
sendMessageOption(Message message, String pushContent, String pushData, SendMessageOption option, Array<String> userIds, boolean isFilterBlackList, NativeClient.ISendMessageCallback<Message> callback)
void
removeMessageAllExpansion(String messageUId, NativeClient.OperationCallback callback)
void
removeMessageExpansion(List<String> keyArray, String messageUId, NativeClient.OperationCallback callback)
void
SetRTCHeartbeatListener(RTCHeartbeatListener listener)
void
SendRTCHeartbeat(Array<String> roomId, int timeout)
void
setModuleReceiveMessageListener(NativeClient.OnReceiveMessageListener listener)
设置消息监听 void
addModules(Map<String, IMLibExtensionModuleIPC> modules)
void
onIPCProcessInit()
Map
onMethodCall(String className, String methodKey, Map param)
boolean
batchInsertMessage(List<Message> messages, boolean enableCheck)
void
addTag(TagInfo tagInfo, NativeClient.OperationCallback callback)
void
removeTag(String tagId, NativeClient.OperationCallback callback)
void
updateTag(TagInfo tagInfo, NativeClient.OperationCallback callback)
void
getTags(IProgressResultCallback callback)
void
getTagsFromConversation(ConversationIdentifier conversationIdentifier, IProgressResultCallback callback)
void
getConversationTopStatusInTag(ConversationIdentifier conversationIdentifier, String tagId, IBooleanCallback callback)
void
addConversationsToTag(String tagId, List<ConversationIdentifier> conversationIdentifierList, NativeClient.OperationCallback callback)
void
removeConversationsFromTag(String tagId, List<ConversationIdentifier> conversationIdentifierList, NativeClient.OperationCallback callback)
void
removeTagsFromConversation(ConversationIdentifier conversationIdentifier, List<String> tagIds, NativeClient.OperationCallback callback)
void
getConversationsFromTagByPage(String tagId, long ts, int count, IProgressResultCallback callback)
void
getUnreadCountByTag(String tagId, boolean containBlocked, IIntegerCallback callback)
void
setConversationToTopInTag(String tagId, ConversationIdentifier conversationIdentifier, String channelId, boolean isTop, NativeClient.OperationCallback callback)
int
getCachedReadReceiptVersion()
void
sendReadReceiptMessage(String targetId, String channelId, Array<String> msgUId, ISendReadReceiptMessageCallback callback)
void
getMessageReadUserList(String groupId, String channelId, String msgUId, NativeClient.IResultCallbackEx<Integer, Array<NativeObject.UserInfo>> callback)
void
updateSDKVersion(String version, String appVersion)
int
SendRTCSignaling(String roomId, String signalingName, boolean isQuery, Array<byte> pbBuffer, int timeout, NativeClient.IResultCallback<Array<byte>> callback)
int
CancelRTCSignaling(Array<int> requestId)
void
SetRTCRoomEventListener(RTCRoomEventListener listener)
MsgUidInfo
getMessageUid(String targetId, int conversationType, String channelId, long startTime, long endTime, int limit)
void
setHttpDownloadInterceptor(HttpDownloadInterceptor interceptor)
设置媒体文件下载拦截器 此拦截器必须在 IPC 进程设置 void
getUltraGroupChannelList(String targetId, int channelType, IProgressResultCallback callback)
void
setCheckDuplicateMessage(boolean enableCheck)
void
getPrivateMessageDeliverTime(String channelId, String uid, NativeClient.IResultCallback<Long> callback)
void
getGroupMessageDeliverList(String groupId, String channelId, String msgUId, NativeClient.IResultCallbackEx<Integer, Array<NativeObject.UserInfo>> callback)
long
getMessageDeliverTime(String msgUid)
void
syncUltraGroupReadStatus(String targetId, String channelId, long timestamp, NativeClient.OperationCallback callback)
void
sendUltraGroupTypingStatus(String targetId, String channelId, int operateType, NativeClient.OperationCallback callback)
void
getUltraGroupMentionCount(String targetId, IIntegerCallback callback)
void
deleteUltraGroupMessagesForAllChannel(String targetId, long timestamp, IBooleanCallback callback)
void
deleteUltraGroupMessages(String targetId, String channelId, long timestamp, IBooleanCallback callback)
void
deleteRemoteUltraGroupMessages(String targetId, String channelId, long timestamp, NativeClient.OperationCallback callback)
void
modifyUltraGroupMessage(String uid, Array<byte> messageContent, List<String> searchableWord, NativeClient.OperationCallback callback)
void
getBatchRemoteUltraGroupMessages(List<Message> msgList, NativeClient.GetBatchRemoteUltraGroupMessageCallback callback)
void
getConversationListForAllChannel(int conversationType, String targetId, IProgressResultCallback callback)
void
removeUltraGroupMessageExpansion(List<String> keyArray, String messageUId, NativeClient.OperationCallback callback)
void
updateUltraGroupMessageExpansion(Map expansion, String messageUId, NativeClient.OperationCallback callback)
void
getUltraGroupConversationList(IProgressResultCallback callback)
NativeObject.TranslationInfo
getTranslationInfo(int messageId, String language)
void
saveMessageTranslation(int message, String content, String targetLanguage)
boolean
isSupportTranslation()
String
getAiAddress()
void
getConversationChannelNotificationLevel(ConversationType conversationType, String targetId, String channelId, NativeClient.IResultCallback<Integer> callback)
获取会话消息提醒状态。 void
setConversationNotificationLevel(ConversationType conversationType, String targetId, int level, NativeClient.OperationCallback callback)
void
setConversationsNotificationLevel(List<ConversationIdentifier> conversationIdentifierList, int level, NativeClient.OperationCallback callback)
void
getConversationNotificationLevel(ConversationType conversationType, String targetId, NativeClient.IResultCallback<Integer> callback)
void
setConversationTypeNotificationLevel(ConversationType conversationType, int level, NativeClient.OperationCallback callback)
void
getConversationTypeNotificationLevel(ConversationType conversationType, NativeClient.IResultCallback<Integer> callback)
void
getUltraGroupConversationDefaultNotificationLevel(String targetId, NativeClient.IResultCallback<Integer> callback)
void
getUltraGroupConversationChannelDefaultNotificationLevel(String targetId, String channelId, NativeClient.IResultCallback<Integer> callback)
void
setUltraGroupConversationDefaultNotificationLevel(String targetId, int level, NativeClient.OperationCallback callback)
void
setUltraGroupConversationChannelDefaultNotificationLevel(String targetId, String channelId, int level, NativeClient.OperationCallback callback)
void
getUltraGroupUnreadCount(String targetId, IIntegerCallback callback)
void
getUltraGroupAllUnreadCount(IIntegerCallback callback)
void
getUltraGroupAllUnreadMentionedCount(IIntegerCallback callback)
void
getConversationListWithAllChannel(Array<int> conversationTypes, IProgressResultCallback callback)
void
getConversationListWithAllChannelByPage(Array<int> conversationTypes, long timeStamp, int count, IProgressResultCallback callback)
void
searchMessageForAllChannel(String targetId, int categoryId, String keyword, int count, long timestamp, IProgressResultCallback callback)
void
searchMessageByTimestampForAllChannel(String targetId, int categoryId, String keyword, long startTime, long endTime, int offset, int limit, IProgressResultCallback callback)
void
searchConversationForAllChannel(String keyword, Array<int> types, Array<String> objName, IProgressResultCallback callback)
void
getLevelUnreadCount(Array<int> types, Array<int> levels, IIntegerCallback callback)
void
getUnreadMentionedCount(Array<int> types, Array<int> levels, IIntegerCallback callback)
void
getUltraGroupUnreadCountByLevels(String targetId, Array<int> levels, IIntegerCallback callback)
void
getUltraGroupUnreadMentionedCount(String targetId, Array<int> levels, IIntegerCallback callback)
void
getUltraGroupUnreadMentionedDigests(String targetId, String channelId, long sendTime, int count, NativeObject.MentionedDigestCallback callback)
void
sendGroupCallSignalInfo(String targetId, String key, String signalInfo, IGroupCallSignalCallBack callback)
void
getUltraGroupMessageCountByTimeRange(String targetId, Array<String> channelIdList, long startTime, long endTime, IIntegerCallback callback)
void
getConversationMessageCountByTimeRange(String targetId, int conversationType, long startTime, long endTime, IIntegerCallback callback)
void
setGroupCallSignalListener(IGroupCallSignalListener listener)
void
sendReadReceiptMessage(int conversationType, String targetId, String channelId, String startMsgUid, String endMsgUid, ISendReadReceiptMessageCallback callback)
void
getMessageReadReceipt(String targetId, String channelId, String msgUId, IGetMessageReaderV4Callback callback)
void
updateConversationReadTime(int conversationType, String targetId, String channelId, long readTime, NativeClient.OperationCallback callback)
void
setMessageExpansionListener(IMessageExpansionListener listener)
void
setMessageDeliverListener(IMessageDeliverListener listener)
void
setMessageHandlerInterceptor(NativeClient.MessageHandlerInterceptor messageHandlerInterceptor)
-
-
Method Detail
-
getNativeObj
NativeObject getNativeObj()
-
getDeviceId
String getDeviceId()
-
getMessageInterceptor
NativeClient.IPCMessageInterceptor getMessageInterceptor()
-
setMessageInterceptor
void setMessageInterceptor(NativeClient.IPCMessageInterceptor listener)
设置 IPC 进程消息拦截器 此拦截器必须在 IPC 进程设置
-
getInstance
static NativeClient getInstance()
-
getApplicationContext
static Context getApplicationContext()
-
threadFactory
static ThreadFactory threadFactory(String name, boolean daemon)
-
setIsInBackground
void setIsInBackground(boolean isInBackground)
-
transformMessage
NativeObject.Message transformMessage(Message msg)
-
init
void init(Context context, String appKey, String deviceId, RCConfiguration configuration, String soDir)
初始化 SDK。
- Parameters:
context
- 应用上下文。
-
initAppendixModule
void initAppendixModule()
初始化非主要的模块
-
registerMessageType
void registerMessageType(Class<out MessageContent> msgType)
注册消息类型,如果对消息类型进行扩展,可以忽略此方法。
- Parameters:
msgType
- 消息类型,必须要继承自 MessageContent
-
registerMessageType
void registerMessageType(List<Class<out MessageContent>> msgTypeList)
批量注册消息类型,如果对消息类型进行扩展,可以忽略此方法。
- Parameters:
msgTypeList
- 消息类型列表,列表中的消息类型必须要继承自 MessageContent
-
disconnect
void disconnect()
断开连接(默认断开后接收Push消息)。
-
disconnect
void disconnect(boolean isReceivePush)
断开连接。
- Parameters:
isReceivePush
- 断开后是否接收push。
-
getConversationList
void getConversationList(String channelId, IProgressResultCallback callback)
获取会话列表。
会话列表按照时间从前往后排列,如果有置顶会话,则置顶会话在前。
- Parameters:
channelId
- 消息所属会话的业务标识。- Returns:
会话列表。
-
getConversationList
void getConversationList(Array<int> conversationTypeValues, String channelId, IProgressResultCallback callback)
根据 conversation 数组 获取对应对会话列表
- Parameters:
conversationTypeValues
- 会话类型channelId
- 消息所属会话的业务标识。- Returns:
获取的会话列表
-
renderMessageContent
MessageContent renderMessageContent(String objectName, Array<byte> content, Message message)
-
newMessageContent
MessageContent newMessageContent(String objectName, Array<byte> content)
-
getMessageHandler
MessageHandler<? extends MessageContent> getMessageHandler(String objectName)
-
getConversationList
List<Conversation> getConversationList(Array<int> conversationTypeValues)
根据 conversation 数组 获取对应对会话列表
- Parameters:
conversationTypeValues
- 会话类型- Returns:
获取的会话列表
-
getBlockedConversationList
void getBlockedConversationList(Array<int> conversationTypes, String channelId, IProgressResultCallback callback)
-
getTopConversationList
void getTopConversationList(Array<int> conversationTypes, String channelId, IProgressResultCallback callback)
获取置顶会话列表
- Parameters:
conversationTypes
- 获取的会话类型数组channelId
- 消息所属会话的业务标识。- Returns:
置顶会话列表
-
getUnreadConversationList
void getUnreadConversationList(Array<int> conversationTypeValues, IProgressResultCallback callback)
根据 conversation 数组 获取对应对的未读会话列表
- Parameters:
conversationTypeValues
- 会话类型- Returns:
获取的会话列表
-
getConversationListByPage
void getConversationListByPage(Array<int> conversationTypeValues, long timeStamp, int count, String channelId, IProgressResultCallback callback)
分页获取会话列表
- Parameters:
conversationTypeValues
- 获取的会话类型数组timeStamp
- 时间戳,获取从此时间戳往前的会话,第一次传 0count
- 取回的会话个数channelId
- 消息所属会话的业务标识。- Returns:
会话列表
-
getInfoForConversations
void getInfoForConversations(Array<String> targetIds, IProgressResultCallback callback)
根据超级群的TargetId数组,获取每个超级群下所有频道的会话未读信息
- Parameters:
targetIds
- 超级群会话的TargetId数组- Since:
5.4.6
-
getConversation
void getConversation(ConversationType conversationType, String targetId, String channelId, IResultCallback callback)
获取某一会话信息。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。channelId
- 消息所属会话的业务标识。- Returns:
会话信息。
-
removeConversation
void removeConversation(ConversationType conversationType, String tId, String channelId, IBooleanCallback callback)
从会话列表中移除某一会话,但是不删除会话内的消息。
如果此会话中有新的消息,该会话将重新在会话列表中显示,并显示最近的历史消息。
- Parameters:
conversationType
- 会话类型。tId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。channelId
- 消息所属会话的业务标识。- Returns:
是否移除成功。
-
removeConversations
void removeConversations(List<ConversationIdentifier> conversationIdentifierList, IBooleanCallback callback)
批量从会话列表中移除会话,但是不删除会话内的消息。
如果此会话中有新的消息,该会话将重新在会话列表中显示,并显示最近的历史消息。
- Parameters:
conversationIdentifierList
- 会话标识列表- Returns:
是否移除成功。
-
setConversationToTop
void setConversationToTop(ConversationType conversationType, String targetId, String channelId, boolean isTop, boolean needCreate, IBooleanCallback callback)
设置某一会话为置顶或者取消置顶。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。channelId
- 消息所属会话的业务标识。isTop
- 是否置顶。needCreate
- 会话不存在时,是否创建会话。- Returns:
是否设置成功。
-
setConversationsToTop
void setConversationsToTop(List<ConversationIdentifier> conversationIdentifierList, boolean isTop, boolean needCreate, IBooleanCallback callback)
批量设置会话为置顶或者取消置顶。
- Parameters:
conversationIdentifierList
- 会话标识列表isTop
- 是否置顶。needCreate
- 会话不存在时,是否创建会话。- Returns:
是否设置成功。
-
createEncryptedConversation
boolean createEncryptedConversation(String targetId, RCEncryptedSession chatInfo)
创建加密会话
- Parameters:
targetId
- encId + ;;; + 对端userIdchatInfo
- 加密会话信息- Returns:
执行结果
-
getEncryptedConversation
RCEncryptedSession getEncryptedConversation(String targetId)
获取加密会话
- Parameters:
targetId
- encId + ;;; + 对端userId- Returns:
执行结果
-
getAllEncryptedConversations
List<RCEncryptedSession> getAllEncryptedConversations()
获取本地所有加密会话信息
- Returns:
加密会话信息列表
-
setEncryptedConversation
boolean setEncryptedConversation(String targetId, RCEncryptedSession chatInfo)
更新targetId对应的Conversation。
- Parameters:
targetId
- 要更新的conversation的targetId。encId + ;;; + 对端userId- Returns:
执行结果
-
removeEncryptedConversation
boolean removeEncryptedConversation(String targetId)
删除对应targetId的加密会话
- Parameters:
targetId
- encId + ;;; + 对端userId- Returns:
执行结果
-
clearEncryptedConversations
boolean clearEncryptedConversations()
清除所有的加密会话。
- Returns:
执行结果
-
getTotalUnreadCount
void getTotalUnreadCount(String channelId, boolean containBlocked, IIntegerCallback callback)
获取所有未读消息数。
- Parameters:
channelId
- 消息所属会话的业务标识。- Returns:
未读消息数。
-
getUnreadCount
void getUnreadCount(ConversationType conversationType, String targetId, String channelId, IIntegerCallback callback)
获取来自某用户(某会话)的未读消息数。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识。- Returns:
未读消息数。
-
getMessageCount
void getMessageCount(ConversationType conversationType, String targetId, String channelId, IIntegerCallback callback)
获取来自某用户(某会话)的消息总数。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识。- Returns:
消息总数。
-
getTotalUnreadCount
void getTotalUnreadCount(Array<Conversation> conversations, IIntegerCallback callback)
获取指定会话的总未读消息数
- Parameters:
conversations
- 会话的可变参数,此方法调用会话构造只需要传参 conversationType 和 targetId 即可。- Returns:
未读消息数。
-
getUnreadCount
void getUnreadCount(String channelId, Array<ConversationType> conversationTypes, IIntegerCallback callback)
获取某会话类型的未读消息数.
- Parameters:
conversationTypes
- 会话类型- Returns:
未读消息数。
-
getUnreadCount
void getUnreadCount(String channelId, boolean withDND, Array<ConversationType> conversationTypes, IIntegerCallback callback)
获取某会话类型的未读消息数.
- Parameters:
withDND
- 是否带有消息免打扰的会话类型conversationTypes
- 消息类型- Returns:
未读消息数
-
getLatestMessages
void getLatestMessages(ConversationType conversationType, String targetId, String channelId, int count, IProgressResultCallback callback)
获取最新消息记录。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。channelId
- 消息所属会话的业务标识count
- 要获取的消息数量。- Returns:
最新消息记录,按照时间顺序从新到旧排列。
-
getHistoryMessages
void getHistoryMessages(ConversationType conversationType, String targetId, String channelId, long oldestMessageId, int count, IProgressResultCallback callback)
获取历史消息记录。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识oldestMessageId
- 最后一条消息的 Id,获取此消息之前的 count 条消息。count
- 要获取的消息数量。- Returns:
历史消息记录,按照时间顺序从新到旧排列。
-
getHistoryMessages
List<Message> getHistoryMessages(ConversationType conversationType, String targetId, String channelId, String objectName, long oldestMessageId, int count)
获取历史消息记录。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识objectName
- 消息类型标识oldestMessageId
- 最后一条消息的 Id,获取此消息之前的 count 条消息,没有消息第一次调用应设置为:-1。count
- 要获取的消息数量。- Returns:
历史消息记录,按照时间顺序从新到旧排列。
-
getHistoryMessages
void getHistoryMessages(ConversationType conversationType, String targetId, String channelId, String objectName, long oldestMessageId, int count, boolean direction, IProgressResultCallback callback)
根据会话类型的目标 Id,回调方式获取某消息类型的某条消息之前或之后的N条历史消息记录。如: 要获取messageId为22的之前的10条图片消息, 则相应参数为 getHistoryMessages(conversationType, targetId, "RC:ImgMsg", 22, 10, true, resultCallback)。 注意:返回的消息列表里面不包含oldestMessageId本身。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。channelId
- 消息所属会话的业务标识objectName
- 消息类型标识。如RC:TxtMsg,RC:ImgMsg,RC:VcMsg等。oldestMessageId
- 最后一条消息的 Id,获取此消息之前的 count 条消息,没有消息第一次调用应设置为:-1。count
- 要获取的消息数量direction
- 要获取的消息相对于oldestMessageId的方向。如果要获取oldestMessageId之前的消息,则该参数设置为true; 如果要获取oldestMessageId之后的消息,则该参数设置为false.- Returns:
返回符合条件的消息列表,以距离oldestMessageId距离的远近排列,距离最近的在最前面。
比如有六条消息,messageId分别为:0,1,2,3,4,5. 如果获取messageId为3的消息之前的三条消息,则返回的顺序是{2,1,0}; 如果获取messageId为3的消息之后的3条消息,则返回的消息列表顺序为{4,5}
-
getHistoryMessages
void getHistoryMessages(ConversationType conversationType, String targetId, String channelId, List<String> objectNames, long timestamp, int count, boolean direction, IProgressResultCallback callback)
根据会话类型的目标 Id,回调方式获取某些消息类型的某条消息之前或之后的N条历史消息记录。如: 要获取
messageId
为22的之前的10条图片消息和文字消息List<String> objectNames = new ArrayList<>(); objectNames.add("RC:ImgMsg"); objectNames.add("RC:TxtMsg"); 则相应参数为 getHistoryMessages(conversationType, targetId, "RC:ImgMsg", 22, 10, true, resultCallback)。 注意:返回的消息列表里面不包含oldestMessageId本身。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。objectNames
- 消息类型标识List。如RC:TxtMsg,RC:ImgMsg,RC:VcMsg等构成List。timestamp
- 最后一条消息的发送时间,如果没有消息可以设置为 0。count
- 要获取的消息数量direction
- 要获取的消息相对于oldestMessageId的方向。如果要获取oldestMessageId之前的消息,则该参数设置为true; 如果要获取oldestMessageId之后的消息,则该参数设置为false.- Returns:
返回符合条件的消息列表,以距离oldestMessageId距离的远近排列,距离最近的在最前面。
比如有六条消息,messageId分别为:0,1,2,3,4,5. 如果获取messageId为3的消息之前的三条消息,则返回的顺序是{2,1,0}; 如果获取messageId为3的消息之后的3条消息,则返回的消息列表顺序为{4,5}
-
getMessages
void getMessages(ConversationType conversationType, String targetId, String channelId, long timestamp, int count, boolean direction, IProgressResultCallback callback)
根据会话类型的目标 Id,回调方式获取某些消息类型的某条消息之前或之后的N条历史消息记录。如: 要获取
messageId
为22的之前的10条图片消息和文字消息List<String> objectNames = new ArrayList<>(); objectNames.add("RC:ImgMsg"); objectNames.add("RC:TxtMsg"); 则相应参数为 getHistoryMessages(conversationType, targetId, "RC:ImgMsg", 22, 10, true, resultCallback)。 注意:返回的消息列表里面不包含oldestMessageId本身。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。timestamp
- 最后一条消息的发送时间,如果没有消息可以设置为 0。count
- 要获取的消息数量direction
- 要获取的消息相对于oldestMessageId的方向。如果要获取oldestMessageId之前的消息,则该参数设置为true; 如果要获取oldestMessageId之后的消息,则该参数设置为false.- Returns:
返回符合条件的消息列表,以距离oldestMessageId距离的远近排列,距离最近的在最前面。
比如有六条消息,messageId分别为:0,1,2,3,4,5. 如果获取messageId为3的消息之前的三条消息,则返回的顺序是{2,1,0}; 如果获取messageId为3的消息之后的3条消息,则返回的消息列表顺序为{4,5}
-
getRemoteHistoryMessages
void getRemoteHistoryMessages(ConversationType conversationType, String targetId, String channelId, long dataTime, int count, NativeClient.IRemoteMessageResultCallback<List<Message>, Long, Boolean> callback)
获取历史消息记录。 历史消息记录,按照时间顺序从新到旧排列。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识。dataTime
- 从该时间点开始获取消息。count
- 要获取的消息数量,最多 20 条。
-
getRemoteHistoryMessages
void getRemoteHistoryMessages(ConversationType conversationType, String targetId, String channelId, RemoteHistoryMsgOption remoteHistoryMsgOption, NativeClient.IRemoteMessageResultCallback<List<Message>, Long, Boolean> callback)
获取历史消息记录。 历史消息记录,按照时间顺序从新到旧排列。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识。remoteHistoryMsgOption
- RemoteHistoryMsgOption
-
getBatchLocalMessage
void getBatchLocalMessage(ConversationType conversationType, String targetId, String channelId, List<String> messageUIDs, IProgressResultCallback callback)
-
setPushSetting
void setPushSetting(int key, String value, NativeClient.IResultCallback<Long> resultCallback)
Push 设置
- Parameters:
key
- 1:Push Language 2:show push content 3:receive pushvalue
- key=1时, value 为 "en_us"为英文, value 为 "zh_cn" 为英文 key=2时, value 为 "1"表示显示push内容详情, "0" 表示不显示 key=3时, value 为 "1"表示终端离线, Web端或MAC/PC 终端在线, 移动终端接收 Push, "0" 表示不接收resultCallback
- 设置是否成功
-
getPushSetting
void getPushSetting(int key, IStringCallback callback)
获取 Push 设置
- Parameters:
key
- 1:Push Language 2:show push content 3:receive push- Returns:
Push 设置
-
deleteMessages
boolean deleteMessages(Array<int> messageIds)
删除指定的一条或者一组消息。
- Parameters:
messageIds
- 要删除的消息 Id 数组。- Returns:
是否删除成功。
-
deleteMessage
void deleteMessage(ConversationType conversationType, String targetId, String channelId, IBooleanCallback callback)
清空某一会话的所有聊天消息记录。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识。- Returns:
是否清空成功。
-
deleteMessages
void deleteMessages(ConversationType conversationType, String targetId, String channelId, Array<Message> messages, NativeClient.OperationCallback callback)
删除指定的一条或者一组消息。会同时删除本地和远端消息。
- Parameters:
conversationType
- 会话类型。暂时不支持群组、讨论组和聊天室targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、客服 Id。channelId
- 消息所属会话的业务标识。messages
- 要删除的消息数组。callback
- 是否删除成功的回调。
-
clearMessages
void clearMessages(ConversationType conversationType, String targetId, String channelId, IBooleanCallback callback)
清空某一会话的所有聊天消息记录。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识。- Returns:
是否清空成功。
-
clearMessages
void clearMessages(List<ClearMessageOption> clearMessageOptionList, IBooleanCallback callback)
异步批量删除指定会话早于(含)发送时间的所有本地数据库消息。
- Parameters:
clearMessageOptionList
- 删除消息参数列表
-
clearRemoteMessages
void clearRemoteMessages(List<ClearMessageOption> clearMessageOptionList, boolean isDeleteLocal, NativeClient.OperationCallback callback)
批量指定会话按发送时间删除远端消息,同时决定是否连带删除本地消息
- Parameters:
clearMessageOptionList
- 删除消息参数列表
-
cleanRemoteHistoryMessages
void cleanRemoteHistoryMessages(ConversationType conversationType, String targetId, String channelId, long recordTime, NativeClient.OperationCallback callback)
清空某一会话,某一时间戳之前的聊天历史记录
- Parameters:
targetId
- 会话目标IDchannelId
- 消息所属会话的业务标识。recordTime
- 清除消息截止时间戳,【0 ~ 当前时间的 Unix 时间戳】callback
- 清除消息的回调
-
cleanHistoryMessages
void cleanHistoryMessages(ConversationType conversationType, String targetId, String channelId, long recordTime, NativeClient.OperationCallback callback)
清空某一会话,某一时间戳之前的聊天历史记录
- Parameters:
conversationType
- 会话类型targetId
- 会话目标IDchannelId
- 消息所属会话的业务标识recordTime
- 清除消息截止时间戳,【0 ~ 当前时间的 Unix 时间戳】callback
- 清除消息的回调
-
clearMessagesUnreadStatus
void clearMessagesUnreadStatus(ConversationType conversationType, String targetId, String channelId, IBooleanCallback callback)
清除消息未读状态。
- Parameters:
conversationType
- 会话类型。不支持传入 ConversationType.targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识。- Returns:
是否清空成功。
-
setMessageExtra
void setMessageExtra(int messageId, String value, IBooleanCallback callback)
设置消息的附加信息,此信息只保存在本地。
- Parameters:
messageId
- 消息 Id。value
- 消息附加信息,最大 1024 字节。- Returns:
是否设置成功。
-
setMessageReceivedStatus
boolean setMessageReceivedStatus(int messageId, ReceivedStatus receivedStatus)
设置接收到的消息状态。
- Parameters:
messageId
- 消息 Id。receivedStatus
- 接收到的消息状态。- Returns:
是否设置成功。
-
setMessageSentStatus
void setMessageSentStatus(int messageId, SentStatus sentStatus, IBooleanCallback callback)
设置发送的消息状态。
- Parameters:
messageId
- 消息 Id。sentStatus
- 发送的消息状态。- Returns:
是否设置成功。
-
clearTextMessageDraft
void clearTextMessageDraft(ConversationType conversationType, String targetId, String channelId, IBooleanCallback callback)
清除某一会话的文字消息草稿。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。channelId
- 消息所属会话的业务标识。- Returns:
是否清除成功。
-
getTextMessageDraft
void getTextMessageDraft(ConversationType conversationType, String targetId, String channelId, IStringCallback callback)
获取某一会话的文字消息草稿。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。channelId
- 消息所属会话的业务标识。- Returns:
草稿的文字内容。
-
saveTextMessageDraft
void saveTextMessageDraft(ConversationType conversationType, String targetId, String channelId, String content, IBooleanCallback callback)
保存文字消息草稿。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。channelId
- 消息所属会话的业务标识。content
- 草稿的文字内容。- Returns:
是否保存成功。
-
getMessage
void getMessage(int messageId, IResultCallback callback)
根据 message id 获取 message
- Parameters:
messageId
- 消息 id- Returns:
消息体
-
getTopStatus
void getTopStatus(String targetId, int conversationType, String channelId, IBooleanCallback callback)
-
getUnreadCountByObjectName
void getUnreadCountByObjectName(String targetId, int conversationType, Array<String> objectNames, String channelId, IIntegerCallback callback)
-
clearMessagesUnreadStatusByTag
void clearMessagesUnreadStatusByTag(String tagId, IBooleanCallback callback)
-
clearConversationsByTag
void clearConversationsByTag(String tagId, boolean deleteMessage, IBooleanCallback callback)
-
hasIPCMessageInterceptor
boolean hasIPCMessageInterceptor()
-
sendMediaMessage
void sendMediaMessage(Message message, String pushContent, String pushData, NativeClient.ISendMediaMessageCallback<Message> mediaMessageCallback)
-
sendMediaMessage
void sendMediaMessage(Message message, Array<String> userIds, String pushContent, String pushData, NativeClient.ISendMediaMessageCallback<Message> mediaMessageCallback)
-
sendMediaMessage
void sendMediaMessage(Message message, String pushContent, String pushData, SendMessageOption option, NativeClient.ISendMediaMessageCallback<Message> mediaMessageCallback)
-
uploadMedia
void uploadMedia(Message message, NativeClient.IResultProgressCallback<String> callback)
上传媒体文件。
上传文件。 用来实现自定义消息时,上传消息中的文件内容到服务器。
- Parameters:
message
- 需要上传的多媒体消息。callback
- 上传文件的回调。
-
getGIFLimitSize
int getGIFLimitSize()
-
getVideoLimitTime
int getVideoLimitTime()
-
insertSettingMessage
Message insertSettingMessage(Message message)
模拟消息。
- Parameters:
message
- 消息实体。- Returns:
发送的消息实体。
-
insertSettingMessage
Message insertSettingMessage(Message message, String msgUid)
模拟消息。
- Parameters:
message
- 消息实体。msgUid
- 消息uid。- Returns:
发送的消息实体。
-
downloadMedia
void downloadMedia(ConversationType conversationType, String targetId, int type, String mediaUrl, NativeClient.IResultProgressCallback<String> callback)
下载文件。
用来获取媒体原文件时调用。如果本地缓存中包含此文件,则从本地缓存中直接获取,否则将从服务器端下载。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。type
- 文件类型。mediaUrl
- 文件的 URL 地址。callback
- 下载文件的回调。
-
downloadMediaMessage
void downloadMediaMessage(Message message, NativeClient.IDownloadMediaMessageCallback<Message> callback)
下载多媒体文件。
用来获取媒体原文件时调用。如果本地缓存中包含此文件,则从本地缓存中直接获取,否则将从服务器端下载。
- Parameters:
message
- 需要下载的文件消息。callback
- 下载文件的回调, 支持取消文件下载的回调。
-
downloadMediaFile
void downloadMediaFile(String uid, String fileUrl, String fileName, String path, NativeClient.IDownloadMediaFileCallback<String> callback)
下载多媒体文件。
用来获取媒体原文件时调用。如果本地缓存中包含此文件,则从本地缓存中直接获取,否则将从服务器端下载。
- Parameters:
uid
- 文件唯一标识fileUrl
- 需要下载的文件地址。fileName
- 文件名path
- 文件下载保存目录,如果是 targetVersion 29 为目标,由于访问权限原因,建议使用 context.callback
- 下载文件的回调, 支持取消文件下载的回调。
-
getConversationNotificationStatus
void getConversationNotificationStatus(ConversationType conversationType, String targetId, String channelId, NativeClient.IResultCallback<Integer> callback)
获取会话消息提醒状态。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识callback
- 获取状态的回调。
-
setConversationNotificationStatus
void setConversationNotificationStatus(ConversationType conversationType, String targetId, String channelId, int level, NativeClient.OperationCallback callback)
设置会话消息提醒状态。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识。callback
- 设置状态的回调。
-
setOnReceiveMessageListener
void setOnReceiveMessageListener(NativeClient.OnReceiveMessageListener listener)
设置接收消息的监听器。
所有接收到的消息、通知、状态都经由此处设置的监听器处理。包括私聊消息、讨论组消息、群组消息、聊天室消息以及各种状态。
- Parameters:
listener
- 接收消息的监听器。
-
setConnectionStatusListener
void setConnectionStatusListener(NativeClient.ICodeListener listener)
设置连接状态变化的监听器。
- Parameters:
listener
- 连接状态变化的监听器。
-
getDeltaTime
long getDeltaTime()
获取本地时间与服务器时间的差值。
- Returns:
本地时间与服务器时间的差值。
-
clearConversations
void clearConversations(String channelId, Array<ConversationType> conversationTypes, IBooleanCallback callback)
清空所有会话及会话消息
- Parameters:
channelId
- 消息所属会话的业务标识。conversationTypes
- 会话类型
-
addToBlacklist
void addToBlacklist(String userId, NativeClient.OperationCallback callback)
将某个用户加到黑名单中。
- Parameters:
userId
- 用户 Id。callback
- OperationCallback
-
recallMessage
void recallMessage(String objectName, Array<byte> content, String pushContent, Message message, NativeClient.OperationCallback callback)
-
removeFromBlacklist
void removeFromBlacklist(String userId, NativeClient.OperationCallback callback)
将个某用户从黑名单中移出。
- Parameters:
userId
- 用户 Id。callback
- 移除黑名单回调。
-
getBlacklistStatus
void getBlacklistStatus(String userId, NativeClient.IResultCallback<NativeClient.BlacklistStatus> callback)
获取某用户是否在黑名单中。
- Parameters:
userId
- 用户 Id。callback
- 获取用户是否在黑名单回调。
-
getBlacklist
void getBlacklist(IStringCallback callback)
获取当前用户的黑名单列表。
- Parameters:
callback
- 获取黑名单回调。
-
setNotificationQuietHours
void setNotificationQuietHours(String startTime, int spanMinutes, int level, NativeClient.OperationCallback callback)
设置会话通知免打扰时间。
- Parameters:
startTime
- 起始时间 格式 HH:MM:SS。spanMinutes
- 间隔分钟数0 < spanMinutes < 1440
。callback
- 设置会话通知免打扰时间回调。
-
removeNotificationQuietHours
void removeNotificationQuietHours(NativeClient.OperationCallback callback)
移除会话通知免打扰时间。
- Parameters:
callback
- 移除会话通知免打扰时间回调。
-
getNotificationQuietHours
void getNotificationQuietHours(NativeClient.GetNotificationQuietHoursCallback callback)
获取会话通知免打扰时间。
- Parameters:
callback
- 获取会话通知免打扰时间回调。
-
updateMessageReceiptStatus
void updateMessageReceiptStatus(String targetId, int categoryId, String channelId, long timestamp, IBooleanCallback callback)
-
clearUnreadByReceipt
void clearUnreadByReceipt(int conversationType, String targetId, String channelId, long timestamp, IBooleanCallback callback)
-
getSendTimeByMessageId
long getSendTimeByMessageId(int messageId)
-
updateConversationInfo
void updateConversationInfo(ConversationType conversationType, String targetId, String channelId, String title, String portrait, IBooleanCallback callback)
-
getVoIPKey
void getVoIPKey(int engineType, String channelName, String extra, NativeClient.IResultCallback<String> callback)
-
getVoIPCallInfo
String getVoIPCallInfo()
-
isGzipEnabled
boolean isGzipEnabled()
-
getNavPreferenceValue
String getNavPreferenceValue(String key)
-
requestNav
void requestNav(String appKey, String token, boolean notify)
-
getSaveCacheDir
String getSaveCacheDir()
-
obtainMediaFileSavedUri
Uri obtainMediaFileSavedUri()
-
getDbLastModified
long getDbLastModified(Context context, String appKey, String userId, String dbName)
-
getDbPath
String getDbPath(Context context, String appKey, String userId, String dbName)
-
initHttpDns
void initHttpDns()
-
setMessageContent
boolean setMessageContent(int messageId, Array<byte> messageContent, String objectName)
-
getToken
String getToken()
-
isKvStorageEnabled
boolean isKvStorageEnabled()
-
isDnsEnabled
boolean isDnsEnabled()
-
unreadCountDroveByServer
boolean unreadCountDroveByServer()
-
isGROpened
boolean isGROpened()
-
getUnreadMentionedMessages
void getUnreadMentionedMessages(ConversationType conversationType, String targetId, String channelId, int count, boolean desc, IProgressResultCallback callback)
-
getOfflineMessageDuration
void getOfflineMessageDuration(IStringCallback callback)
-
setOfflineMessageDuration
void setOfflineMessageDuration(String duration, NativeClient.IResultCallback<Long> callback)
-
switchAppKey
void switchAppKey(String appKey, String deviceId)
-
getTheFirstUnreadMessage
void getTheFirstUnreadMessage(int conversationType, String targetId, String channelId, IResultCallback callback)
-
setReconnectKickEnable
void setReconnectKickEnable(boolean enable)
设置是否允许重连时踢人
- Parameters:
enable
- 是否允许重连时踢人
-
SetPushNotificationListener
void SetPushNotificationListener(NativeClient.PushNotificationListener listener)
-
setConversationStatusListener
void setConversationStatusListener(NativeObject.ConversationStatusListener listener)
-
setConversationListener
void setConversationListener(NativeObject.RTConversationListener listener)
-
setUltraGroupEventListener
void setUltraGroupEventListener(NativeObject.ReceiveUltraGroupEventListener listener)
-
getCurrentUserId
String getCurrentUserId()
获取当前登录用户的 user id
- Returns:
返回 user id
-
getRTCProfile
String getRTCProfile()
-
getUploadLogConfigAddressDataList
List<ServerAddressData> getUploadLogConfigAddressDataList()
获取最近一次导航中上传日志配置信息
-
getStatsAddressDataList
List<ServerAddressData> getStatsAddressDataList()
获取最近一次导航中上传统计服务配置信息
-
updateVoIPCallInfo
void updateVoIPCallInfo(String rtcProfile)
-
sdkBackgroundChanged
void sdkBackgroundChanged(boolean isInBackground)
-
updateMessageExpansion
void updateMessageExpansion(Map<String, String> expansion, String messageUId, NativeClient.OperationCallback callback)
-
getMessageByUid
Message getMessageByUid(String uid)
-
getMessageByUIds
Array<NativeObject.Message> getMessageByUIds(Array<String> uidArray)
-
sendMessageOption
void sendMessageOption(Message message, String pushContent, String pushData, SendMessageOption option, Array<String> userIds, NativeClient.ISendMessageCallback<Message> callback)
-
sendMessageOption
void sendMessageOption(Message message, String pushContent, String pushData, SendMessageOption option, Array<String> userIds, boolean isFilterBlackList, NativeClient.ISendMessageCallback<Message> callback)
-
removeMessageAllExpansion
void removeMessageAllExpansion(String messageUId, NativeClient.OperationCallback callback)
-
removeMessageExpansion
void removeMessageExpansion(List<String> keyArray, String messageUId, NativeClient.OperationCallback callback)
-
SetRTCHeartbeatListener
void SetRTCHeartbeatListener(RTCHeartbeatListener listener)
-
SendRTCHeartbeat
void SendRTCHeartbeat(Array<String> roomId, int timeout)
-
setModuleReceiveMessageListener
void setModuleReceiveMessageListener(NativeClient.OnReceiveMessageListener listener)
设置消息监听
- Parameters:
listener
- 消息接收监听
-
addModules
void addModules(Map<String, IMLibExtensionModuleIPC> modules)
-
onIPCProcessInit
void onIPCProcessInit()
-
onMethodCall
Map onMethodCall(String className, String methodKey, Map param)
-
batchInsertMessage
boolean batchInsertMessage(List<Message> messages, boolean enableCheck)
-
addTag
void addTag(TagInfo tagInfo, NativeClient.OperationCallback callback)
-
removeTag
void removeTag(String tagId, NativeClient.OperationCallback callback)
-
updateTag
void updateTag(TagInfo tagInfo, NativeClient.OperationCallback callback)
-
getTags
void getTags(IProgressResultCallback callback)
-
getTagsFromConversation
void getTagsFromConversation(ConversationIdentifier conversationIdentifier, IProgressResultCallback callback)
-
getConversationTopStatusInTag
void getConversationTopStatusInTag(ConversationIdentifier conversationIdentifier, String tagId, IBooleanCallback callback)
-
addConversationsToTag
void addConversationsToTag(String tagId, List<ConversationIdentifier> conversationIdentifierList, NativeClient.OperationCallback callback)
-
removeConversationsFromTag
void removeConversationsFromTag(String tagId, List<ConversationIdentifier> conversationIdentifierList, NativeClient.OperationCallback callback)
-
removeTagsFromConversation
void removeTagsFromConversation(ConversationIdentifier conversationIdentifier, List<String> tagIds, NativeClient.OperationCallback callback)
-
getConversationsFromTagByPage
void getConversationsFromTagByPage(String tagId, long ts, int count, IProgressResultCallback callback)
-
getUnreadCountByTag
void getUnreadCountByTag(String tagId, boolean containBlocked, IIntegerCallback callback)
-
setConversationToTopInTag
void setConversationToTopInTag(String tagId, ConversationIdentifier conversationIdentifier, String channelId, boolean isTop, NativeClient.OperationCallback callback)
-
getCachedReadReceiptVersion
int getCachedReadReceiptVersion()
-
sendReadReceiptMessage
void sendReadReceiptMessage(String targetId, String channelId, Array<String> msgUId, ISendReadReceiptMessageCallback callback)
-
getMessageReadUserList
void getMessageReadUserList(String groupId, String channelId, String msgUId, NativeClient.IResultCallbackEx<Integer, Array<NativeObject.UserInfo>> callback)
-
updateSDKVersion
void updateSDKVersion(String version, String appVersion)
-
SendRTCSignaling
int SendRTCSignaling(String roomId, String signalingName, boolean isQuery, Array<byte> pbBuffer, int timeout, NativeClient.IResultCallback<Array<byte>> callback)
-
CancelRTCSignaling
int CancelRTCSignaling(Array<int> requestId)
-
SetRTCRoomEventListener
void SetRTCRoomEventListener(RTCRoomEventListener listener)
-
getMessageUid
MsgUidInfo getMessageUid(String targetId, int conversationType, String channelId, long startTime, long endTime, int limit)
-
setHttpDownloadInterceptor
void setHttpDownloadInterceptor(HttpDownloadInterceptor interceptor)
设置媒体文件下载拦截器 此拦截器必须在 IPC 进程设置
-
getUltraGroupChannelList
void getUltraGroupChannelList(String targetId, int channelType, IProgressResultCallback callback)
-
setCheckDuplicateMessage
void setCheckDuplicateMessage(boolean enableCheck)
-
getPrivateMessageDeliverTime
void getPrivateMessageDeliverTime(String channelId, String uid, NativeClient.IResultCallback<Long> callback)
-
getGroupMessageDeliverList
void getGroupMessageDeliverList(String groupId, String channelId, String msgUId, NativeClient.IResultCallbackEx<Integer, Array<NativeObject.UserInfo>> callback)
-
getMessageDeliverTime
long getMessageDeliverTime(String msgUid)
-
syncUltraGroupReadStatus
void syncUltraGroupReadStatus(String targetId, String channelId, long timestamp, NativeClient.OperationCallback callback)
-
sendUltraGroupTypingStatus
void sendUltraGroupTypingStatus(String targetId, String channelId, int operateType, NativeClient.OperationCallback callback)
-
getUltraGroupMentionCount
void getUltraGroupMentionCount(String targetId, IIntegerCallback callback)
-
deleteUltraGroupMessagesForAllChannel
void deleteUltraGroupMessagesForAllChannel(String targetId, long timestamp, IBooleanCallback callback)
-
deleteUltraGroupMessages
void deleteUltraGroupMessages(String targetId, String channelId, long timestamp, IBooleanCallback callback)
-
deleteRemoteUltraGroupMessages
void deleteRemoteUltraGroupMessages(String targetId, String channelId, long timestamp, NativeClient.OperationCallback callback)
-
modifyUltraGroupMessage
void modifyUltraGroupMessage(String uid, Array<byte> messageContent, List<String> searchableWord, NativeClient.OperationCallback callback)
-
getBatchRemoteUltraGroupMessages
void getBatchRemoteUltraGroupMessages(List<Message> msgList, NativeClient.GetBatchRemoteUltraGroupMessageCallback callback)
-
getConversationListForAllChannel
void getConversationListForAllChannel(int conversationType, String targetId, IProgressResultCallback callback)
-
removeUltraGroupMessageExpansion
void removeUltraGroupMessageExpansion(List<String> keyArray, String messageUId, NativeClient.OperationCallback callback)
-
updateUltraGroupMessageExpansion
void updateUltraGroupMessageExpansion(Map expansion, String messageUId, NativeClient.OperationCallback callback)
-
getUltraGroupConversationList
void getUltraGroupConversationList(IProgressResultCallback callback)
-
getTranslationInfo
NativeObject.TranslationInfo getTranslationInfo(int messageId, String language)
-
saveMessageTranslation
void saveMessageTranslation(int message, String content, String targetLanguage)
-
isSupportTranslation
boolean isSupportTranslation()
-
getAiAddress
String getAiAddress()
-
getConversationChannelNotificationLevel
void getConversationChannelNotificationLevel(ConversationType conversationType, String targetId, String channelId, NativeClient.IResultCallback<Integer> callback)
获取会话消息提醒状态。
- Parameters:
conversationType
- 会话类型。targetId
- 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。channelId
- 消息所属会话的业务标识callback
- 获取状态的回调。
-
setConversationNotificationLevel
void setConversationNotificationLevel(ConversationType conversationType, String targetId, int level, NativeClient.OperationCallback callback)
-
setConversationsNotificationLevel
void setConversationsNotificationLevel(List<ConversationIdentifier> conversationIdentifierList, int level, NativeClient.OperationCallback callback)
-
getConversationNotificationLevel
void getConversationNotificationLevel(ConversationType conversationType, String targetId, NativeClient.IResultCallback<Integer> callback)
-
setConversationTypeNotificationLevel
void setConversationTypeNotificationLevel(ConversationType conversationType, int level, NativeClient.OperationCallback callback)
-
getConversationTypeNotificationLevel
void getConversationTypeNotificationLevel(ConversationType conversationType, NativeClient.IResultCallback<Integer> callback)
-
getUltraGroupConversationDefaultNotificationLevel
void getUltraGroupConversationDefaultNotificationLevel(String targetId, NativeClient.IResultCallback<Integer> callback)
-
getUltraGroupConversationChannelDefaultNotificationLevel
void getUltraGroupConversationChannelDefaultNotificationLevel(String targetId, String channelId, NativeClient.IResultCallback<Integer> callback)
-
setUltraGroupConversationDefaultNotificationLevel
void setUltraGroupConversationDefaultNotificationLevel(String targetId, int level, NativeClient.OperationCallback callback)
-
setUltraGroupConversationChannelDefaultNotificationLevel
void setUltraGroupConversationChannelDefaultNotificationLevel(String targetId, String channelId, int level, NativeClient.OperationCallback callback)
-
getUltraGroupUnreadCount
void getUltraGroupUnreadCount(String targetId, IIntegerCallback callback)
-
getUltraGroupAllUnreadCount
void getUltraGroupAllUnreadCount(IIntegerCallback callback)
-
getUltraGroupAllUnreadMentionedCount
void getUltraGroupAllUnreadMentionedCount(IIntegerCallback callback)
-
getConversationListWithAllChannel
void getConversationListWithAllChannel(Array<int> conversationTypes, IProgressResultCallback callback)
-
getConversationListWithAllChannelByPage
void getConversationListWithAllChannelByPage(Array<int> conversationTypes, long timeStamp, int count, IProgressResultCallback callback)
-
searchMessageForAllChannel
void searchMessageForAllChannel(String targetId, int categoryId, String keyword, int count, long timestamp, IProgressResultCallback callback)
-
searchMessageByTimestampForAllChannel
void searchMessageByTimestampForAllChannel(String targetId, int categoryId, String keyword, long startTime, long endTime, int offset, int limit, IProgressResultCallback callback)
-
searchConversationForAllChannel
void searchConversationForAllChannel(String keyword, Array<int> types, Array<String> objName, IProgressResultCallback callback)
-
getLevelUnreadCount
void getLevelUnreadCount(Array<int> types, Array<int> levels, IIntegerCallback callback)
-
getUnreadMentionedCount
void getUnreadMentionedCount(Array<int> types, Array<int> levels, IIntegerCallback callback)
-
getUltraGroupUnreadCountByLevels
void getUltraGroupUnreadCountByLevels(String targetId, Array<int> levels, IIntegerCallback callback)
-
getUltraGroupUnreadMentionedCount
void getUltraGroupUnreadMentionedCount(String targetId, Array<int> levels, IIntegerCallback callback)
-
getUltraGroupUnreadMentionedDigests
void getUltraGroupUnreadMentionedDigests(String targetId, String channelId, long sendTime, int count, NativeObject.MentionedDigestCallback callback)
-
sendGroupCallSignalInfo
void sendGroupCallSignalInfo(String targetId, String key, String signalInfo, IGroupCallSignalCallBack callback)
-
getUltraGroupMessageCountByTimeRange
void getUltraGroupMessageCountByTimeRange(String targetId, Array<String> channelIdList, long startTime, long endTime, IIntegerCallback callback)
-
getConversationMessageCountByTimeRange
void getConversationMessageCountByTimeRange(String targetId, int conversationType, long startTime, long endTime, IIntegerCallback callback)
-
setGroupCallSignalListener
void setGroupCallSignalListener(IGroupCallSignalListener listener)
-
sendReadReceiptMessage
void sendReadReceiptMessage(int conversationType, String targetId, String channelId, String startMsgUid, String endMsgUid, ISendReadReceiptMessageCallback callback)
-
getMessageReadReceipt
void getMessageReadReceipt(String targetId, String channelId, String msgUId, IGetMessageReaderV4Callback callback)
-
updateConversationReadTime
void updateConversationReadTime(int conversationType, String targetId, String channelId, long readTime, NativeClient.OperationCallback callback)
-
setMessageExpansionListener
void setMessageExpansionListener(IMessageExpansionListener listener)
-
setMessageDeliverListener
void setMessageDeliverListener(IMessageDeliverListener listener)
-
setMessageHandlerInterceptor
void setMessageHandlerInterceptor(NativeClient.MessageHandlerInterceptor messageHandlerInterceptor)
-
-
-
-