SDKsAndroid
Get the current user profile
Use getSelfLocalUserInfo() to retrieve the local profile for the current user.
OpenIMClient.getInstance().userInfoManager.getSelfLocalUserInfo(
new OnBase<LocalUser>() {
@Override
public void onSuccess(LocalUser user) {
currentUserStore.set(user);
}
@Override
public void onError(int code, String error) {
recordSelfProfileFailure(code, error);
}
}
);After initialization and login, call this method to retrieve the current account's local profile. Success returns LocalUser with fields such as userID, nickname, faceURL, ex, attachedInfo, globalRecvMsgOpt, and addFriendPermission.
Returned fields
| Field | Description |
|---|---|
userID | Signed-in user ID. |
nickname | Current account nickname. |
faceURL | Current account avatar URL. |
ex | Current account extension string. |
attachedInfo | SDK-attached data; parse only an application-defined format. |
globalRecvMsgOpt | Global message reception: 0 receive, 1 do not receive, 2 receive without notification. |
addFriendPermission | Add-friend permission value defined by the server contract. |
The query does not trigger a profile callback. Clear the previous account snapshot when logging out or switching accounts so that the previous user's data is not rendered for the new account.
getSelfUserInfo() is deprecated and is not the recommended API.
Was this page helpful?