User overview
Learn about current-user profiles, public user profiles, account settings, and online status in the Android SDK.
OpenIM Android SDK identifies each user by userID. User APIs retrieve and update the current account profile, retrieve public user profiles, and subscribe to user online status.
Friends, friend requests, and blacklists are relationship capabilities between users. See Relationship overview for their types, APIs, and state updates.
User objects
Android SDK returns different user objects for different scenarios:
| Type | Use case | Main APIs |
|---|---|---|
LocalUser | The signed-in user's local profile, settings page, avatar, nickname, and account-level settings | getSelfLocalUserInfo(), setSelfInfo() |
PublicUserInfo | Application user lookup and public profile cards | getUsersInfo() |
UsersOnlineStatus | User online status and connected platforms | subscribeUsersOnlineStatus(), getSubscribeOnlineUsersStatus(), unsubscribeOnlineUsersStatus() |
LocalUser represents the signed-in user, while PublicUserInfo represents a public user profile returned by a query. Group member profiles, in-group nicknames, and member management belong to group capabilities.
Feature entry points
| Requirement | Recommended page |
|---|---|
Retrieve public profiles by userID for profile cards | Get specified user profiles |
| Read or update the current user's nickname, avatar, and extension data | Get the current user profile, Update the current user profile |
| Configure account-level message reception and notification behavior | Set global message reception |
| Choose how other users can add the current account | Set friend request permissions |
| Subscribe to, retrieve, and unsubscribe from online status | Subscribe to user online status, Get subscribed user online status, Unsubscribe from user status |
| Manage friends, friend requests, or the blacklist | Relationship overview |
State updates
Set the user listener for user-related state changes. See the corresponding capability pages below for details about each callback:
OpenIMClient client = OpenIMClient.getInstance();
client.userInfoManager.setOnUserListener(new OnUserListener() {
@Override
public void onSelfInfoUpdated(UserInfo info) {
// Handle current-user profile changes.
}
@Override
public void onUserStatusChanged(UsersOnlineStatus status) {
// Handle user online-status changes.
}
});- Current user profile changes: Update the current user profile.
- Online status changes: Subscribe to user online status.
- Friend, friend-request, and blacklist changes: Relationship overview.
Was this page helpful?