hyphenate_SDK4.0 4.8.0
hyphenate java IM SDK
Public Member Functions | List of all members
com.hyphenate.chat.EMFetchMessageOption Class Reference

Inherits com.hyphenate.chat.EMBase< T >.

Public Member Functions

 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)
 

Detailed Description

The parameter configuration class for pulling historical messages from the server.

Constructor & Destructor Documentation

◆ EMFetchMessageOption()

com.hyphenate.chat.EMFetchMessageOption.EMFetchMessageOption ( )

The constructor.

Member Function Documentation

◆ setDirection()

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

Sets the message search direction.

Parameters
directionThe message search direction. See EMConversation.EMSearchDirection.
  • (Default) UP: Messages are retrieved in the descending order of the Unix timestamp included in them.
    • DOWN: Messages are retrieved in the ascending order of the Unix timestamp included in them.

◆ setEndTime()

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

Sets the end time for message query.

Parameters
endTimeThe end time for message query. The time is a UNIX time stamp in milliseconds. The default value is -1, indicating that this parameter is ignored during message query.
  • If the start time is set to a specific time spot and the end time uses the default value -1, the SDK returns messages that are sent and received in the period that is from the start time to the current time.
  • If the start time uses the default value -1 and the end time is set to a specific time spot, the SDK returns messages that are sent and received in the period that is from the timestamp of the first message to the current time.

◆ setFrom()

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

Sets the message sender in the group conversation.

Parameters
fromThe user ID of the message sender in the group conversation.

◆ setIsSave()

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

Sets whether the retrieved messages are saved to the database.

Parameters
saveWhether to save the retrieved messages to the database:
  • true: Yes.
  • (Default)false: No.

◆ setMsgTypes()

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

Sets the types of message for query.

Parameters
msgTypesThe list of message types for query. See EMStatisticsManager.EMSearchMessageType. You can set several message types. The default value is null, indicating that all types of messages are retrieved.

◆ setStartTime()

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

Sets the start time for message query.

Parameters
startTimeThe start time for message query. The time is a UNIX time stamp in milliseconds. The default value is -1, indicating that this parameter is ignored during message query.
  • If the start time is set to a specific time spot and the end time uses the default value -1, the SDK returns messages that are sent and received in the period that is from the start time to the current time.
  • If the start time uses the default value -1 and the end time is set to a specific time spot, the SDK returns messages that are sent and received in the period that is from the timestamp of the first message to the current time.

The documentation for this class was generated from the following file: