SDKsAndroidEnterprise
Load newer messages
Use getAdvancedHistoryMessageListReverse to load messages after a starting point.
Retrieve historical messages forward in time (towards newer messages) starting from a specific anchor message. This is commonly used when jumping to a search result, navigating from a quoted reply, or restoring deep-linked message contexts. This method queries stored messages and is not used for real-time message streaming.
Code example
String conversationID = "si_user_a_user_b";
int count = 20;
OpenIMClient.getInstance().messageManager.getAdvancedHistoryMessageListReverse(
new OnBase<AdvancedMessage>() {
@Override
public void onSuccess(AdvancedMessage result) {
List<Message> messages = result.getMessageList();
boolean reachedLatest = result.isEnd();
// Deduplicate by clientMsgID and append messages to the bottom of the active timeline
}
@Override
public void onError(int code, String error) {
// Failed to load newer messages
}
},
conversationID,
startMessage,
count,
ViewType.History
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<AdvancedMessage> | Yes | Callback handler for the asynchronous request. |
conversationID | String | Yes | Globally unique ID of the target conversation. |
startMsg | Message | Yes | Anchor starting message from which forward loading begins. |
count | int | Yes | Maximum number of messages to retrieve in this batch. |
viewType | ViewType | Yes | View mode enum. Pass ViewType.History for regular history loads. |
Return value
Upon success, onSuccess returns an AdvancedMessage object. messageList contains messages chronologically after the anchor message, and isEnd indicates whether the newest stored message boundary has been reached.
State changes after the call
- Snapshot retrieval: This is a read-only query that loads point-in-time message records without emitting new-message events.
- Timeline update: Append deduplicated messages to the bottom of the chat list using
clientMsgID. Real-time incoming messages continue to be received via Receive messages.
Was this page helpful?