Typing indicator

Layer provides a simple way to let applications send and receive typing indicator events. This lets you implement interfaces to inform users that another participant is actively engaged in communicating with them.

Sending typing indicators

You can send typing events by calling send() on a Conversation instance. This will send a typing indicator showing that the currently authenticated user is typing. All participants in the conversation will receive the typing indicator. LayerKit supports three typing indicator states: TypingIndicator.STARTED, TypingIndicator.PAUSED, and TypingIndicator.FINISHED.

// Sends a typing indicator event to the given conversation.

Receiving typing indicators

Applications are notified of typing indicator events via LayerTypingIndicatorListener. You should register a typing indicator listener to be notified when another device is typing:

public class MyApplication extends Application implements LayerTypingIndicatorListener {

    protected void onResume() {
        // Register this Activity to receive remote typing indications from Layer

    protected void onPause() {
        // Stop receiving remote typing indications from Layer when this Activity pauses


Upon receipt of a typing indicator event, you can check the Conversation, user’s Identity, and TypingIndicator for information about the typing event:

public void onTypingIndicator(LayerClient client, Conversation conversation, Identity user, TypingIndicator indicator) {

    switch (indicator) {
        case STARTED:
            // This user started typing, so add them to the typing list.

        case PAUSED:
            // Ignore pause, since we only show who is and is not typing.

        case FINISHED:
            // This user isn't typing anymore, so remove them from the list.

    // Update the current-typers UI.
    mTyperTextView.setText(TextUtils.join(", ", mTypers));

How to use

Typing indicator events are ephemeral, which means that Layer doesn’t save them. You can call sendTypingIndicator() as often as you’d like. Layer will merge the calls internally and efficiently send typing indicator events as needed.

After calling sendTypingIndicator with the TypingIndicator.STARTED state, if 10 seconds go by without an update, Layer will automatically send a TypingIndicator.PAUSED event. If another 10 seconds go without an update, LayerKit will send a TypingIndicator.FINISHED event.

Querying Metadata