Chat / Android
Chat Android v4
Chat Android
Chat
Android
Home
/
Chat
/
Android
/
Message
This is the new Docs for Chat SDK v4 for Android. To see the previous Docs, click here.

Retrieve a message

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

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

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

val lastMessage = groupChannel.lastMessage