human: 如何处理七牛云的即时通讯BMXChatManager

gpt: [即时通讯](https://developer.qiniu.com/IM) > API 文档 > [ANDROID
API](https://developer.qiniu.com/IM/api/8191/android-im-class-indexes) >
BMXChatManager

#  BMXChatManager

最近更新时间: 2022-07-22 22:43:10

class im.floo.floolib.BMXChatManager

聊天管理器

Index

方法

  * sendMessage
  * resendMessage
  * recallMessage
  * forwardMessage
  * forwardMessage
  * readAllMessage
  * removeMessage
  * removeMessage
  * ackMessage
  * readCancel
  * downloadThumbnail
  * downloadAttachment
  * cancelDownloadAttachment
  * cancelUploadAttachment
  * transferingNum
  * insertMessages
  * getMessage
  * deleteConversation
  * openConversation
  * getAllConversations
  * getAllConversationsUnreadCount
  * retrieveHistoryMessages
  * searchMessages
  * searchMessages
  * getGroupAckMessageUserIdList
  * addChatListener
  * removeChatListener

方法

sendMessage

  * public void sendMessage(final BMXMessage msg);
  * 发送消息，消息状态变化会通过listener通知

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

发送的消息

Returns void

resendMessage

  * public void resendMessage(final BMXMessage msg);
  * 重新发送消息，消息状态变化会通过listener通知

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

重新发送的消息

Returns void

recallMessage

  * public void recallMessage(final BMXMessage msg);
  * 撤回消息，消息状态变化会通过listener通知

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

撤回的消息

Returns void

forwardMessage

  * public void forwardMessage(final BMXMessageList list, final BMXConversation to, final BMXMessage newMsg, final BMXCallBack callBack);
  * 合并转发消息

Parameters

    * list: BMXMessageList 

转发的消息列表

    * to: [BMXConversation](https://developer.qiniu.com/IM/api/8207/bmx-conversation)

消息被转发到的会话

    * newMsg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

转发的消息列表合并后生成的新的单条转发消息

    * callBack: BMXCallBack 

BMXErrorCode

Returns void

forwardMessage

  * public void forwardMessage(final BMXMessage msg);
  * 简单转发消息，用户应当通过BMXMessage::createForwardMessage()先创建转发消息

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

转发的消息

Returns void

readAllMessage

  * public void readAllMessage(final BMXMessage msg);
  * 标记此消息及之前全部消息为已读，该消息同步到当前用户的所有设备

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

需要标记为此消息以前全部消息为已读的消息

Returns void

removeMessage

  * public void removeMessage(final BMXMessage msg, final boolean synchronize);
  * 删除此消息，该消息同步到当前用户的其它设备

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

需要删除的消息

    * synchronize: boolean 

是否同步到其它设备，不同步的情况下只会删除本地存储的该条消息

Returns void

removeMessage

  * public void removeMessage(final BMXMessage msg);
  * Returns void

ackMessage

  * public void ackMessage(final BMXMessage msg);
  * 发送已读回执

Returns void

readCancel

  * public void readCancel(final BMXMessage msg);
  * 设置未读

Returns void

downloadThumbnail

  * public void downloadThumbnail(final BMXMessage msg);
  * 下载缩略图，下载状态变化和进度通过listener通知 缩略图生成策略，1 - 第三方服务器生成， 2 - 本地服务器生成，默认值是 1。

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

需要下载缩略图的消息

Returns void

downloadAttachment

  * public void downloadAttachment(final BMXMessage msg);
  * 下载附件，下载状态变化和进度通过listener通知

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

需要下载附件的消息

Returns void

cancelDownloadAttachment

  * public void cancelDownloadAttachment(final BMXMessage msg);
  * 取消下载附件

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

需要下载附件的消息

Returns void

cancelUploadAttachment

  * public void cancelUploadAttachment(final BMXMessage msg);
  * 取消上传附件

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

需要上传附件的消息

Returns void

transferingNum

  * public int transferingNum();
  * 正在上传或下载中的文件数

Returns int

insertMessages

  * public void insertMessages(final BMXMessageList list, final BMXCallBack callBack);
  * 插入消息

Parameters

    * list: BMXMessageList 

插入消息列表

    * callBack: BMXCallBack 

BMXErrorCode

Returns void

getMessage

  * public void getMessage(final long msgId, final BMXDataCallBack<BMXMessage> callBack);
  * 读取一条消息

Parameters

    * msgId: long 

需要获取消息的消息id

    * callBack: <any>

BMXMessage

Returns void

deleteConversation

  * public void deleteConversation(final long conversationId, final Boolean sync);
  * 删除会话

Parameters

    * conversationId: long 

需要删除会话的会话id

    * sync: Boolean 

是否同步删除其它设备该会话，默认为false，仅删除本设备会话

Returns void

openConversation

  * public void openConversation(final long conversationId, final BMXConversation.Type type, final boolean createIfNotExist, final BMXDataCallBack<BMXConversation> callBack);
  * 打开一个会话

Parameters

    * conversationId: long 

需要打开的会话的会话id

    * type: Type 

会话的类型，单聊还是群聊。

    * createIfNotExist: boolean 

会话不存在的情况下是否要创建本地会话，默认为创建

    * callBack: <any>

BMXConversation

Returns void

getAllConversations

  * public void getAllConversations(final BMXDataCallBack<BMXConversationList> callBack);
  * 获取所有会话

Parameters

    * callBack: <any>

BMXConversationList

Returns void

getAllConversationsUnreadCount

  * public void getAllConversationsUnreadCount(final BMXDataCallBack<Integer> callBack);
  * 获取所有会话的全部未读数（标记为屏蔽的个人和群组的未读数不统计在内）

Parameters

    * callBack: <any>

未读数

Returns void

retrieveHistoryMessages

  * public void retrieveHistoryMessages(final BMXConversation conversation, final long refMsgId, final long size, final BMXDataCallBack<BMXMessageList> callBack);
  * 拉取历史消息

Parameters

    * conversation: [BMXConversation](https://developer.qiniu.com/IM/api/8207/bmx-conversation)

需要拉取历史消息的会话

    * refMsgId: long 

拉取会话消息的起始消息Id

    * size: long 

拉取的最大消息条数

    * callBack: <any>

BMXErrorCode，拉取操作获取的消息列表

Returns void

searchMessages

  * public void searchMessages(final String keywords, final long refTime, final long size, final BMXConversation.Direction arg4, final BMXDataCallBack<BMXMessageListList> callBack);
  * 搜索消息

Parameters

    * keywords: String 

搜索的关键字

    * refTime: long 

搜索消息的起始时间

    * size: long 

搜索的最大消息条数

    * arg4: Direction 

消息搜索方向，默认（Direction::Up）是从更早的消息中搜索

    * callBack: <any>

BMXErrorCode，搜索到的消息结果列表

Returns void

searchMessages

  * public void searchMessages(final String keywords, final long refTime, final long size, final BMXDataCallBack<BMXMessageListList> callBack);
  * Returns void

getGroupAckMessageUserIdList

  * public void getGroupAckMessageUserIdList(final BMXMessage msg, final BMXDataCallBack<ListOfLongLong> callBack);
  * 获取发送的群组消息已读用户id列表

Parameters

    * msg: [BMXMessage](https://developer.qiniu.com/IM/api/8239/bmxmessage)

需要获取已读用户id列表的消息

    * callBack: <any>

BMXErrorCode,对该条消息已读的用户id列表

Returns void

addChatListener

  * public void addChatListener(BMXChatServiceListener listener);
  * 添加聊天监听者

Parameters

    * listener: [BMXChatServiceListener](https://developer.qiniu.com/IM/api/8197/bmxchatservicelistener)

聊天监听者

Returns void

removeChatListener

  * public void removeChatListener(BMXChatServiceListener listener);
  * 移除聊天监听者

Parameters

    * listener: [BMXChatServiceListener](https://developer.qiniu.com/IM/api/8197/bmxchatservicelistener)

聊天监听者

Returns void

以上内容是否对您有帮助？