Querying Messages

The two important functions to know while querying a message are:

  • Stack from End

  • Pagination

Stack from End

While the SDK will always return messages in chronological order, developers can ask for the messages to begin from the top of the listview or the bottom of the listview depeding on scrolling direction.

There are other situations where fetching the oldest messages is preferred, for example for archiving purposes or in community forums. (When stack from end is set to false, the list fills its content starting from the top of the view)

Pagination

When querying messages, you cannot set limit, skip, after, first, before, and last parameters. To handle pagination to load more messages, refer to Live collection pagination.

To query for a list of all messages in a channel:

This method will return all messages in the specified channel as Stream<List<AmityMessage>>

Last updated