Package io.rong.imlib

Class NativeClient

  • All Implemented Interfaces:

    
    public final class NativeClient
    
                        

    IM 客户端核心类。

    所有 IM 相关方法、监听器都由此调用和设置。

    • Constructor Detail

    • Method Detail

      • threadFactory

         static ThreadFactory threadFactory(String name, boolean daemon)
      • init

         void init(Context context, String appKey, String deviceId, RCConfiguration configuration, String soDir)

        初始化 SDK。

        Parameters:
        context - 应用上下文。
      • 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:

        获取的会话列表

      • getMessageHandler

         MessageHandler<? extends MessageContent> getMessageHandler(String objectName)
      • getConversationList

         List<Conversation> getConversationList(Array<int> conversationTypeValues)

        根据 conversation 数组 获取对应对会话列表

        Parameters:
        conversationTypeValues - 会话类型
        Returns:

        获取的会话列表

      • 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 - 时间戳,获取从此时间戳往前的会话,第一次传 0
        count - 取回的会话个数
        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 + ;;; + 对端userId
        chatInfo - 加密会话信息
        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:

        执行结果

      • 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 push
        value - 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 - 会话目标ID
        channelId - 消息所属会话的业务标识。
        recordTime - 清除消息截止时间戳,【0 ~ 当前时间的 Unix 时间戳】
        callback - 清除消息的回调
      • cleanHistoryMessages

         void cleanHistoryMessages(ConversationType conversationType, String targetId, String channelId, long recordTime, NativeClient.OperationCallback callback)

        清空某一会话,某一时间戳之前的聊天历史记录

        Parameters:
        conversationType - 会话类型
        targetId - 会话目标ID
        channelId - 消息所属会话的业务标识
        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)
      • clearConversationsByTag

         void clearConversationsByTag(String tagId, boolean deleteMessage, IBooleanCallback callback)
      • uploadMedia

         void uploadMedia(Message message, NativeClient.IResultProgressCallback<String> callback)

        上传媒体文件。

        上传文件。 用来实现自定义消息时,上传消息中的文件内容到服务器。

        Parameters:
        message - 需要上传的多媒体消息。
        callback - 上传文件的回调。
      • 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 - 接收消息的监听器。
      • getDeltaTime

         long getDeltaTime()

        获取本地时间与服务器时间的差值。

        Returns:

        本地时间与服务器时间的差值。

      • clearConversations

         void clearConversations(String channelId, Array<ConversationType> conversationTypes, IBooleanCallback callback)

        清空所有会话及会话消息

        Parameters:
        channelId - 消息所属会话的业务标识。
        conversationTypes - 会话类型
      • 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 - 设置会话通知免打扰时间回调。
      • 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)
      • updateConversationInfo

         void updateConversationInfo(ConversationType conversationType, String targetId, String channelId, String title, String portrait, IBooleanCallback callback)
      • requestNav

         void requestNav(String appKey, String token, boolean notify)
      • getDbLastModified

         long getDbLastModified(Context context, String appKey, String userId, String dbName)
      • getDbPath

         String getDbPath(Context context, String appKey, String userId, String dbName)
      • setMessageContent

         boolean setMessageContent(int messageId, Array<byte> messageContent, String objectName)
      • getUnreadMentionedMessages

         void getUnreadMentionedMessages(ConversationType conversationType, String targetId, String channelId, int count, boolean desc, IProgressResultCallback 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 - 是否允许重连时踢人
      • getCurrentUserId

         String getCurrentUserId()

        获取当前登录用户的 user id

        Returns:

        返回 user id

      • getStatsAddressDataList

         List<ServerAddressData> getStatsAddressDataList()

        获取最近一次导航中上传统计服务配置信息

      • addModules

         void addModules(Map<String, IMLibExtensionModuleIPC> modules)
      • onMethodCall

         Map onMethodCall(String className, String methodKey, Map param)
      • batchInsertMessage

         boolean batchInsertMessage(List<Message> messages, boolean enableCheck)
      • getTags

         void getTags(IProgressResultCallback callback)
      • getTagsFromConversation

         void getTagsFromConversation(ConversationIdentifier conversationIdentifier, IProgressResultCallback callback)
      • getConversationTopStatusInTag

         void getConversationTopStatusInTag(ConversationIdentifier conversationIdentifier, String tagId, IBooleanCallback callback)
      • getUnreadCountByTag

         void getUnreadCountByTag(String tagId, boolean containBlocked, IIntegerCallback callback)
      • sendReadReceiptMessage

         void sendReadReceiptMessage(String targetId, String channelId, Array<String> msgUId, ISendReadReceiptMessageCallback callback)
      • 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)
      • deleteUltraGroupMessages

         void deleteUltraGroupMessages(String targetId, String channelId, long timestamp, IBooleanCallback callback)
      • getBatchRemoteUltraGroupMessages

         void getBatchRemoteUltraGroupMessages(List<Message> msgList, NativeClient.GetBatchRemoteUltraGroupMessageCallback callback)
      • getConversationChannelNotificationLevel

         void getConversationChannelNotificationLevel(ConversationType conversationType, String targetId, String channelId, NativeClient.IResultCallback<Integer> callback)

        获取会话消息提醒状态。

        Parameters:
        conversationType - 会话类型。
        targetId - 目标 Id。根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id。
        channelId - 消息所属会话的业务标识
        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)
      • sendGroupCallSignalInfo

         void sendGroupCallSignalInfo(String targetId, String key, String signalInfo, IGroupCallSignalCallBack callback)
      • 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)