SDKsAndroid
Search friends
Use searchFriends() to search the current user friend list.
OpenIMClient.getInstance().friendshipManager.searchFriends(
new OnBase<List<FriendInfo>>() {
@Override
public void onSuccess(List<FriendInfo> results) {
// Use results to display the search results.
}
@Override
public void onError(int code, String error) {
// Handle the error.
}
},
Collections.singletonList(keyword.trim()),
true,
true,
true
);Pass one non-empty value in keywordList. The three Boolean arguments select matching by user ID, nickname, and friend remark. Enable at least one field. To search multiple fields, enable the corresponding flags.
The callback returns List<FriendInfo>, which can be used to display the search results.
Was this page helpful?