loadMessages

open fun loadMessages(    @NonNull context: Context,     @NonNull conversationId: String,     @Nullable loadMessagesCallback: ILoadMessages)

Call this method to load messages of the given threadItem.

This method will try to load the oldest messages for the given conversation.

The callback represented by loadMessagesCallback parameter is defined in the following list :

  • onStart : called when the load operation is started (means that the request is being sent to the server).
  • onSuccess : called when the load request is successfully sent to the server. The message list will be delivered asynchronously in IConversationObservable callback
  • onError ()} : called when the load request is unsuccessful.

The maximum number of the message to retrieve foreach conversation is configured by the backend and has a default value can be configured manually using the configuration XML file (integer attribute key : maximum_messages_to_retrieve_default_value).

This method should be executed in a worker thread since it contains a lot of operation that can exceed 5sec or block the UI thread.

See also

Parameters

context

The application context

conversationId

The identifier of the conversation

loadMessagesCallback

A useful callback to keep tracking the load of message request.