/ SDKs / Android
SDKs
Chat SDKs Android v4
Chat SDKs Android
Chat SDKs
Android
Version 4

Retrieve a message

Copy link

You can retrieve a specific message in an open or group channel by creating and passing the MessageRetrievalParams object as an argument into the getMessage() method.

// Create a MessageRetrievalParams object.
val params = MessageRetrievalParams(channelUrl: CHANNEL_URL, channelType: CHANNEL_TYPE, messageId: MESSAGE_ID)
// ...

// Pass the params as an argument to the parameter of the getMessage() method.
BaseMessage.getMessage(params) { message, e ->
    if (e != null) {
        // Handle error.
    }

    // The specified message is successfully retrieved.
    // ...
}

List of properties

Copy link
Property nameTypeDescription

channelUrl

String

Specifies the URL of the channel.

channelType

ChannelType

Specifies the type of the channel.

messageId

Long

Specifies the unique ID of the message.


Retrieve the last message of a group channel

Copy link

You can retrieve and view the last message of a group channel.

val lastMessage = groupChannel.lastMessage