SDKsAndroid
Get friend profiles
Batch query detailed friend relationships, remarks, and user profiles by user IDs.
Batch query friend relationship details using a list of user IDs. Retrieved items include friend remarks, custom relation extensions, and basic user profile information.
Code example
OpenIMClient.getInstance().friendshipManager.getFriendsInfo(
new OnBase<List<UserInfo>>() {
@Override
public void onSuccess(List<UserInfo> friends) {
for (UserInfo friend : friends) {
// Update friend profiles using friends
}
}
@Override
public void onError(int code, String error) {
// Handle error
}
},
Arrays.asList("user_a", "user_b"),
true
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<List<UserInfo>> | Yes | Callback delivering the asynchronous operation result. |
userIDs | List<String> | Yes | List of target friend user IDs. Filter empty strings and duplicate entries before calling. |
filterBlack | boolean | Yes | When true, automatically filters out blocked users; when false, includes blocked friends. |
Return value
The successful callback returns a List<UserInfo> containing matched friend entries. Merge the records into your local friend cache using userID as the primary key.
If a specified user is not a friend or was excluded due to filterBlack == true, that user is omitted from the returned list. To display public profile cards for non-friends, call Get user profiles; to verify bilateral relationship state without fetching full profiles, see Check friendship status.
Was this page helpful?