Browse SDKs · Android
SDKsAndroid

Get specified friend profiles

Use getFriendsInfo() to query friendship profiles for specified users.

Copy
OpenIMClient.getInstance().friendshipManager.getFriendsInfo(
    new OnBase<List<UserInfo>>() {
        @Override
        public void onSuccess(List<UserInfo> friends) {
            for (UserInfo friend : friends) {
                friendStore.put(friend.getUserID(), friend);
            }
        }

        @Override
        public void onError(int code, String error) {
            recordFriendInfoFailure(code, error);
        }
    },
    Arrays.asList("user_a", "user_b"),
    true
);

The second argument is the target user ID list. filterBlack controls whether blocked users are removed. Remove empty and duplicate IDs before calling. The callback returns List<UserInfo>; use getFriendInfo() for friend remarks and relationship fields, then merge by userID.

The result can omit a target that is not a friend or is excluded by filterBlack == true. When the UI also needs account-level public data, call Get specified user profiles and merge the two sources by userID.

This query does not trigger friendship callbacks. Use checkFriend() when only the relationship state is needed.