Browse SDKs · Android
SDKsAndroid

User overview

Learn about user profiles, friendships, friend requests, blacklists, and online status in the Android SDK.

Copy

OpenIM Android SDK identifies each user by userID. When implementing profile cards, friend requests, contacts, or a blocklist, distinguish an application's public user profile from the current user's friend relationship and blocklist state.

Group member lists, in-group nicknames, group roles, and member administration belong to the Groups domain. User APIs cover profiles, friendships, friend requests, blacklists, and online status.

User objects

Android SDK returns different user objects for different scenarios:

TypeUse caseMain APIs
LocalUserThe current user's local profile, settings page, avatar, nickname, and account-level receive settinggetSelfLocalUserInfo(), setSelfInfo()
PublicUserInfoApplication user lookup, friend candidates, and profiles for users who are not friendsgetUsersInfo()
UserInfoCombined Android wrapper object that can carry public, friend, or blacklist informationgetFriendListPage(), getFriendsInfo(), getBlacklist()
FriendInfoThe current user's friend list, friend remarks, and relationship extension datasearchFriends(), getFriendListPage()
FriendApplicationInfoThe parties, handling state, and message for a friend requestFriend request queries and callbacks
BlacklistInfoUsers blocked by the current user and their blocklist relationship fieldsgetBlacklist(), addBlacklist(), removeBlacklist()
UsersOnlineStatusUser online status and connected platformssubscribeUsersOnlineStatus(), getSubscribeOnlineUsersStatus()

The same userID can appear in public profile, friend, blocklist, and group member data. Prefer UserInfo.getFriendInfo() when displaying a contact, PublicUserInfo when only a public account profile is needed, and UserInfo.getBlackInfo() on a blocklist screen. Conversation list and chat page titles belong to conversation data and should use the conversation display name.

Use userID as the stable key for user lists and events. A friend request contains both parties, so use fromUserID:toUserID to identify one request.

Feature entry points

RequirementRecommended page
Retrieve public profiles by userID for friend candidates or profile cardsGet specified user profiles
Page through, search, or retrieve friend relationships by IDGet the friend list by page
Send, retrieve, accept, or reject friend requestsGet received friend requests
Update friend dataUpdate friend profiles
Delete a friend relationshipDelete a friend
View and maintain the current user's blocklistGet the blacklist
Read or update the current user's nickname, avatar, and extension dataUpdate the current user profile
Configure account-level message reception and notification behaviorSet global message reception
Subscribe to and retrieve online statusSubscribe to user online status

State updates

Each user-related capability page owns the listener and merge behavior for its events:

UserInfoManager and FriendshipManager each retain one listener. setOnUserListener() and setOnFriendshipListener() replace the current listener. Combine the required callbacks in a shared state layer and set each listener once; multiple pages must not overwrite one another's listeners.