Typing Status

Send typing status#

You can able to send the typing/gone status to the users, so that they can aware of whether user is typing the message or not. if you want send the typing status for a user, you can utilise the below method.

ArgumentTypeDescription
TO_JIDStringjid of the chat user
CHAT_TYPEChatTypeEnumchat type

While user starts typing the message in the input box of the chat window, call the below method to send the composing status, so that they can show a typing message in the header/recent chat.

ChatManager.sendTypingStatus(TO_JID, CHAT_TYPE)

Once user stopped/finished typing the message in the input box of the chat window, call the below method to send the gone status, so that they can hide a typing message in the header/recent chat.

ChatManager.sendTypingGoneStatus(TO_JID, CHAT_TYPE)

Observe the typing status#

To observe the typing status changes, you can use the below method to setup listener for the typing events.

ArgumentType
LISTENERTypingStatusListener
ChatManager.setTypingStatusListener(new TypingStatusListener() {
@Override
public void onChatTypingStatus(@NotNull String fromUserJid, @NotNull TypingStatus status) {
}
@Override
public void onGroupTypingStatus(@NotNull String groupJid, @NotNull String groupUserJid, @NotNull TypingStatus status) {
}
});

Once the listener has been set by the sdk user, the below callbacks will be triggered based on the chat type.

Single chat#

for single chat below callback will be triggered

Callback arguments#

ArgumentTypeDescription
fromUserJidStringjid of the typing user
statusTypingStatusThe status param will be either composing or gone
note

composing means user is typing the message. gone means user stopped the typing

@Override
public void onChatTypingStatus(@NotNull String fromUserJid, @NotNull TypingStatus status) {
}

Group chat#

for group chat below callback will be triggered

Callback arguments#

ArgumentTypeDescription
groupJidStringjid of the group in which user is typing the message
groupUserJidStringjid of the typing user
statusTypingStatusThe status param will be either composing or gone
note

composing means user is typing the message. gone means user stopped the typing

@Override
public void onGroupTypingStatus(@NotNull String groupJid, @NotNull String groupUserJid, @NotNull TypingStatus status) {
}