hyphenate_SDK4.0 4.6.0
hyphenate java IM SDK
Public 成员函数 | 所有成员列表
com.hyphenate.chat.EMFetchMessageOption类 参考

继承自 com.hyphenate.chat.EMBase< T > .

Public 成员函数

 EMFetchMessageOption ()
 
void setIsSave (boolean save)
 
void setDirection (EMConversation.EMSearchDirection direction)
 
void setFrom (String from)
 
void setMsgTypes (List< EMMessage.Type > msgTypes)
 
void setStartTime (long startTime)
 
void setEndTime (long endTime)
 

详细描述

从服务端查询历史消息的参数配置类。

构造及析构函数说明

◆ EMFetchMessageOption()

com.hyphenate.chat.EMFetchMessageOption.EMFetchMessageOption ( )

构造函数。

成员函数说明

◆ setDirection()

void com.hyphenate.chat.EMFetchMessageOption.setDirection ( EMConversation.EMSearchDirection  direction)

设置消息的搜索方向。

参数
direction消息搜索方向。详见 EMConversation.EMSearchDirection
  • (默认)UP:按照消息中的时间戳的逆序查询;
    • DOWN:按照消息中的时间戳的正序查询;

◆ setEndTime()

void com.hyphenate.chat.EMFetchMessageOption.setEndTime ( long  endTime)

设置消息查询的结束时间。

参数
endTime消息查询的结束时间,Unix 时间戳,单位为毫秒。若传 -1,消息查询时会忽略该参数。
  • 若起始时间设置为特定时间点,而结束时间采用默认值 -1,则查询起始时间至当前时间的消息。
  • 若起始时间采用默认值 -1,而结束时间设置了特定时间,SDK 返回从会话中最早的消息到结束时间点的消息。

◆ setFrom()

void com.hyphenate.chat.EMFetchMessageOption.setFrom ( String  from)

设置群组会话中的消息发送方。

参数
from消息的发送方的用户 ID。

◆ setIsSave()

void com.hyphenate.chat.EMFetchMessageOption.setIsSave ( boolean  save)

设置获取的消息是否保存到数据库。

参数
save是否保存到数据库: -true:保存到数据库; -(默认)false:不保存到数据库。

◆ setMsgTypes()

void com.hyphenate.chat.EMFetchMessageOption.setMsgTypes ( List< EMMessage.Type >  msgTypes)

设置要查询的消息类型。

参数
msgTypes要查询的消息类型列表, 详见 EMStatisticsManager.EMSearchMessageType。 你可以设置多个消息类型。默认值 null,表示返回所有类型的消息。

◆ setStartTime()

void com.hyphenate.chat.EMFetchMessageOption.setStartTime ( long  startTime)

设置消息查询的起始时间。

参数
startTime消息查询的起始时间,Unix 时间戳,单位为毫秒。默认为 -1,表示消息查询时会忽略该参数。
  • 若起始时间设置为特定时间点,而结束时间采用默认值 -1,则查询起始时间至当前时间的消息。
  • 若起始时间采用默认值 -1,而结束时间设置了特定时间,SDK 返回从会话中最早的消息到结束时间点的消息。

该类的文档由以下文件生成: