How to migrate to getMessagesByTimestamp from getPreviousMessagesByTimestamp on android

[Problem/Question]
How to migrate from getMessagesByTimestamp to getPreviousMessagesByTimestamp on android

currently i have this implementation to fetch messages

channel?.getPreviousMessagesByTimestamp(
                    createdAt ?: Long.MAX_VALUE,
                    false,
                    CHANNEL_MESSAGE_LIMIT,
                    true,
                    BaseChannel.MessageTypeFilter.ALL,
                    null,
                    null,
                    true,
                    messageHandler
            )

i tried migrating to the newer api, it was a bit confusing but i ended up with this,


val params = MessageListParams(
                CHANNEL_MESSAGE_LIMIT,
                CHANNEL_MESSAGE_LIMIT,
                BaseChannel.MessageTypeFilter.ALL,
                allowedMessageTypes,
                userIds,
                false,
                true,
                true,
                true,
                true,
                true,
                true
            )

            channel?.getMessagesByTimestamp(
                createdAt ?: Long.MAX_VALUE,
                params,
                messageHandler
            )

but this implementation didn’t work, the pagination just returns the same set of messages and completely broke the current implementation.


SDK Version: v3.1.24

@Cjeon any inputs or any headsup?

Hello @arjun,

Apologize for the delay in our response. I had a change to speak with one of our Android engineers and it sounds like you should be passing 0 to nextResultSize instead of CHANNEL_MESSAGE_LIMIT. This is likely what is causing you to receive the duplicate data.