getGroupHistoryMessageList
Introduction
Load the history message list for group chat, especially for those sent before entering the group chat.
When the network is available, the latest cloud data will be pulled; while it is unavailable, the SDK will return the locally stored historical messages.
Only the historical messages of meeting groups (Meeting) can be pulled. For more information on group message limits, see Group System.
This API does not apply to audio-video groups (AVChatRoom), as their messages are not stored on the cloud roaming server or in the local database.
Extending the storage period of historical messages is a value-added service. You can log in to the IM console to modify the relevant configuration. For billing details, see Pricing.
Rich media messages (such as images, files, and audios) have the same storage periods as historical messages.
Parameter details
Parameter name | Parameter type | Required | Platform | Description |
---|---|---|---|---|
groupID | String | yes | All | The group ID. |
count | int | yes | All | The amount of the messages loaded once a request, do not set it so large that might affect the speed of processing. But, on Web, it can not be larger than 15. |
lastMsgID | String | no | All | The starting point of loading messages, it will start from the latest message, if not provided. |
Returned template
V2TimValueCallback<List<V2TimMessage>>
{
code : int
desc : String
data : List<V2TimMessage>
}
Return value details
name | type | description |
---|---|---|
code | int | Request result: Error codes. 0 means success. |
desc | String | The description of the failure. |
data | List< V2TimMessage > | The list of messages received. |
Code example
V2TimValueCallback<List<V2TimMessage>> getGroupHistoryMessageListRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.getGroupHistoryMessageList(
groupID: "groupID",
count: 10,
lastMsgID: null,
);
if (getGroupHistoryMessageListRes.code == 0) {
}