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.

Mark messages as delivered

Delivery receipt can be used to see whether a message has been successfully delivered to all the intended recipients by the Sendbird server. To mark a message as delivered when an offline group channel member receives a push notification for the message from Firebase Cloud Messaging, use the SendbirdChat.markAsDelivered(Map<String, String>) method.

class FirebaseMessagingServiceEx : FirebaseMessagingService() {
    override fun onMessageReceived(remoteMessage: RemoteMessage) {
        SendbirdChat.markAsDelivered(remoteMessage.data)
    }
}

When a message is delivered to a group channel member who is online, the message is marked as delivered and other members who are online are notified of the delivery receipt through the onDeliveryStatusUpdated() method of the channel event handler.

SendbirdChat.addChannelHandler(
    UNIQUE_HANDLER_ID,
    object : GroupChannelHandler() {
        override fun onMessageReceived(channel: BaseChannel, message: BaseMessage) {
            // ...
        }

        override fun onDeliveryStatusUpdated(channel: GroupChannel) {
            // ...
        }
    }
)