Get current user profile
Retrieve the cached profile for the authenticated user from local storage using getSelfLocalUserInfo().
Retrieve a snapshot of the authenticated account's complete profile directly from local storage. This snapshot includes nickname, avatar, custom extension fields, and account-wide preferences. This method reads from local storage without executing network requests.
Code example
OpenIMClient.getInstance().userInfoManager.getSelfLocalUserInfo(
new OnBase<LocalUser>() {
@Override
public void onSuccess(LocalUser user) {
// Update current user profile using user
}
@Override
public void onError(int code, String error) {
// Handle error
}
}
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<LocalUser> | Yes | Callback delivering the asynchronous operation result. |
Return value
The successful callback returns the LocalUser entity representing the authenticated user:
| Field | Description |
|---|---|
userID | Unique global user ID of the authenticated account. |
nickname | Current display nickname. |
faceURL | Current avatar URL. |
ex | Custom business extension string. |
attachedInfo Enterprise | Supplementary business metadata defined by the application. |
globalRecvMsgOpt | Global message reception mode: 0 for normal reception, 1 for rejecting messages, 2 for silent reception without notifications. |
addFriendPermission Enterprise | Friend request verification mode; for detailed values, see Set friend request permissions. |
If the user updates profile attributes from another client or via server-side APIs, the SDK delivers the changes via OnUserListener.onSelfInfoUpdated. Update local cache records using userID as the primary key. For profile mutation APIs and listener registration, see Update the current user profile.
Was this page helpful?