Browse SDKs · Android
Platform
SDKsAndroid

Pin or unpin a conversation

Pin or unpin a conversation at the top of the conversation list for the authenticated user.

Copy

Pin or unpin a conversation in the authenticated user's conversation list. Pinned conversations remain anchored at the top of the list view.

Code example

OpenIMClient.getInstance().conversationManager.pinConversation(
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // Pin request succeeded.
        }

        @Override
        public void onError(int code, String error) {
            // code and error describe the failure.
        }
    },
    conversationID,
    true
);

Parameters

ParameterTypeRequiredDescription
baseOnBase<String>YesCallback delivering the asynchronous operation result.
conversationIDStringYesTarget conversation identifier.
isPinnedbooleanYesSet to true to pin the conversation, or false to unpin it.

Return value

The successful callback indicates that the server recorded the updated pinning status. Pinning affects only the authenticated user's view and does not modify the conversation layout for peer users or group members.

State changes after the call

Once the call succeeds, the SDK dispatches the OnConversationListener.onConversationChanged event. When your listener receives this event, locate the matching local conversation by conversationID, update its isPinned flag, and re-sort the conversation list. For complete listener registration details, see Get the conversation list.