getRemoteHistoryMessages

public abstract void getRemoteHistoryMessages(ConversationType conversationType, String targetId, String channelId, long dateTime, int count, IRongCoreCallback.ResultCallback<List<Message>> callback)

Retrieves historical messages before the specified time from the server. (Not supported for ultra groups)

Unlike getHistoryMessages, this API pulls messages from the RCserver. After pulling messages from the server, the client performs deduplication and returns the deduplicated data. This is typically used to retrieve historical messages after switching to a new device. When using this API, it is recommended to first retrieve historical messages from the local database using getHistoryMessages. If no historical messages are found in the local database, then use this API to retrieve messages from the server, passing the timestamp of the earliest message in the local database.Note: 1. This feature requires enabling the historical message cloud storage function in the RCdeveloper console. 2. If the messages to be retrieved already exist in the local database, this API will not return any data.

Since

5.1.1

Parameters

conversationType

The type of conversation.

targetId

The target conversation ID. Depending on the conversationType, this could be a user ID, discussion group ID, or group ID.

channelId

The business identifier of the conversation to which the message belongs.

dateTime

The starting point in time from which to retrieve messages. This corresponds to the sentTime in the message getSentTime. If there are no messages in the local database, pass 0 for the first call; otherwise, pass the sentTime of the earliest message to retrieve the latest count messages.

count

The number of messages to retrieve, 1 < count <= 20.

callback

The callback for retrieving historical messages, sorted in chronological order from newest to oldest.


public abstract void getRemoteHistoryMessages(ConversationType conversationType, String targetId, String channelId, RemoteHistoryMsgOption remoteHistoryMsgOption, IRongCoreCallback.ResultCallback<List<Message>> callback)

Retrieves the remote history messages for a specified conversation. (Not supported for ultra groups)

This feature requires enabling the Cloud Storage for History Messages in the RongCloud Developer Console.Note: Chatrooms are not supported!

Since

5.1.1

Parameters

conversationType

The type of conversation. Chatrooms are not supported.

targetId

The conversation ID. Depending on the conversationType, this could be a user ID, discussion group ID, or group ID.

channelId

The business identifier of the conversation to which the message belongs.

remoteHistoryMsgOption

Configurable parameters RemoteHistoryMsgOption

callback

The callback for retrieving history messages, ordered from newest to oldest.