Browse SDKs · Android
SDKsAndroid

Update your profile

Use setSelfInfo() to update the nickname, avatar, or extension data of the current user.

Copy

Set only the fields that must change on UserInfoReq.

UserInfoReq request = new UserInfoReq();
request.setNickname(displayName.trim());
request.setFaceURL(avatarURL);
request.setEx(extra);

OpenIMClient.getInstance().userInfoManager.setSelfInfo(
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // Profile update succeeded.
        }

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

This operation updates only the nickname, avatar, and user extension data. Add-friend permission is a separate account setting; see Set friend request permissions.

A successful callback means the update request completed. onSelfInfoUpdated(UserInfo info) reports changes to the current user's profile.

Updatable fields

FieldDescription
nicknameNew nickname.
faceURLNew avatar URL.
exUser extension string.

Send only fields that should change. Account-level message reception is also a separate operation; see Set global message reception.

Receive onSelfInfoUpdated through OnUserListener when the current user's profile changes:

@Override
public void onSelfInfoUpdated(UserInfo info) {
    // Handle the current user's profile change.
}