Browse SDKs · Android
SDKsAndroidEnterprise

Pin or unpin a message

Change a conversation message’s pinned state and handle pinned-message change events.

Copy

Pass true as the final argument to pin the message or false to unpin it:

messageManager.setConversationPinnedMsg(
    callback,
    conversationID,
    clientMsgID,
    true
);

The success callback means that the request completed; it does not mean that the pinned-message event has arrived.

When pinned messages change, OnAdvanceMsgListener.onChangedPinnedMsg returns the corresponding conversationID and current list of pinned messages:

@Override
public void onChangedPinnedMsg(ChangedPinnedMsg event) {
    // event.getMsgs() contains messages whose pinned state changed.
}

MessageManager can retain only one OnAdvanceMsgListener. If the application handles other message events, implement their callbacks in the same listener. See Events for setup. To retrieve the current pinned messages directly, use View pinned messages.