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) {
                // Use friends to update the friend profiles.
            }
        }

        @Override
        public void onError(int code, String error) {
            // Handle the 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.

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.

See Check friendship when only the relationship state is needed.