Core features

The Video SDK for Android provides in-session text chat: users can send public and private messages to everyone or to a specific user, and your app receives a callback as each message arrives. Use the ZoomVideoSDKChatHelper to send messages and listen for onChatNewMessageNotify on your ZoomVideoSDKDelegate to receive them.

To transfer files through chat, see Send files in chat. To read message metadata, delete messages, or apply host chat privileges, see Manage chat messages.

Chat is is designed to support in-session text communication. Zoom truncates messages exceeding a binary size of 10,000 bytes. As a best practice, we recommend a limit of 1000 characters per message.

Note

Common chat implementations in Android use RecyclerView to display messages. The following sections focus on the SDK chat API only. See RecyclerView in Android for the UI side.

Get the chat helper

To send messages or change privileges, grab the ZoomVideoSDKChatHelper from the SDK singleton. Every chat call hangs off it.

val chatHelper = ZoomVideoSDK.getInstance().chatHelper
ZoomVideoSDKChatHelper chatHelper = ZoomVideoSDK.getInstance().getChatHelper();

Send a public message

Before exposing a chat composer in your UI, check that chat is enabled. The host may have disabled it for the session through chat privileges.

if (chatHelper.isChatDisabled) {
    // Chat is disabled for this session — hide your composer.
    return
}
val result = chatHelper.sendChatToAll("This is a public message")
if (result != ZoomVideoSDKErrors.Errors_Success) {
    // Surface the error to the user.
}
if (chatHelper.isChatDisabled()) {
    // Chat is disabled for this session — hide your composer.
    return;
}
int result = chatHelper.sendChatToAll("This is a public message");
if (result != ZoomVideoSDKErrors.Errors_Success) {
    // Surface the error to the user.
}

sendChatToAll returns ZoomVideoSDKErrors.Errors_Success (value 0) when the send is accepted by the SDK; any other value is an error code from ZoomVideoSDKErrors.

Send a private message

Private messages are also a chat privilege the host can disable, separately from public chat. Check isPrivateChatDisabled before exposing a "send to user" UI.

if (chatHelper.isPrivateChatDisabled) {
    // The host has disabled private chat.
    return
}
val result = chatHelper.sendChatToUser(user, "This is a private message")
if (result != ZoomVideoSDKErrors.Errors_Success) {
    // Surface the error to the user.
}
if (chatHelper.isPrivateChatDisabled()) {
    // The host has disabled private chat.
    return;
}
int result = chatHelper.sendChatToUser(user, "This is a private message");
if (result != ZoomVideoSDKErrors.Errors_Success) {
    // Surface the error to the user.
}

Receive incoming messages

Implement onChatNewMessageNotify on your ZoomVideoSDKDelegate. The callback fires for both messages you receive and messages you send. Check isSelfSend if you want to distinguish (see Manage chat messages for the full set of message accessors).

override fun onChatNewMessageNotify(
    chatHelper: ZoomVideoSDKChatHelper?,
    messageItem: ZoomVideoSDKChatMessage
) {
    val content = messageItem.content
    val sender = messageItem.senderUser
    // Add the message to your RecyclerView adapter.
}
@Override
public void onChatNewMessageNotify(
    ZoomVideoSDKChatHelper chatHelper,
    ZoomVideoSDKChatMessage messageItem
) {
    String content = messageItem.getContent();
    ZoomVideoSDKUser sender = messageItem.getSenderUser();
    // Add the message to your RecyclerView adapter.
}

For everything else you can read off a ZoomVideoSDKChatMessage (timestamps, recipients, message ID, public-vs-private flag), see Manage chat messages.