SDKsAndroidEnterprise
Load newer messages
Use getAdvancedHistoryMessageListReverse to load messages after a starting point.
getAdvancedHistoryMessageListReverse() reads toward newer messages after a specified message. Use it to continue downward from a search result or another located message. It runs in the opposite direction from ordinary history loading and does not receive live messages.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | String | Yes | Conversation whose history is being loaded. |
startMsg | Message | Yes | Message after which loading begins. |
count | int | Yes | Maximum number of messages to load; the example uses 20. |
viewType | ViewType | Yes | Pass ViewType.History when browsing message history. |
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, then append messages to the current list.
}
@Override
public void onError(int code, String error) {
// Keep the current list and report that this page failed to load.
}
},
conversationID,
startMessage,
20,
ViewType.History
);Result
The success callback returns AdvancedMessage. messageList contains messages read after the anchor, and isEnd indicates whether the newer end of the available history has been reached. errCode and errMsg carry the business status included in the result object. Continue handling live messages through Receive messages.
Was this page helpful?