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) {
            markFriendUpdateSubmitted();
        }

        @Override
        public void onError(int code, String error) {
            recordFriendUpdateFailure(code, 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, replaced as a complete value.

A successful callback means the update request completed. Merge the friend increment through onFriendInfoChanged, as documented in Get the friend list by page.