Browse SDKs · Android
SDKsAndroid

Update friend profiles

Use updateFriendsReq() to update friend remarks, pinned state, or extension data.

Copy
UpdateFriendsReq request = new UpdateFriendsReq();
request.setFriendUserIDs(new String[] { friendUserID });
request.setRemark(remark.trim());

OpenIMClient.getInstance().friendshipManager.updateFriendsReq(
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // Friend profile update succeeded.
        }

        @Override
        public void onError(int code, String error) {
            // Handle the error.
        }
    },
    request
);

UpdateFriendsReq supports friendUserIDs, remark, isPinned, and ex. One call applies the same field value to every target friend. Use separate calls when friends need different values. ex is a complete string.

FieldDescription
friendUserIDsFriend ID array to update.
remarkFriend remark for the current account.
isPinnedWhether to pin the friend.
exFriendship extension string.

A successful callback means the update-friends request completed. Receive friend profile changes through onFriendInfoChanged, as documented in Get the friend list by page.