Browse SDKs · Android
SDKsAndroid

Search groups

Use searchGroups to search locally available groups by group ID or name.

Copy

searchGroups() accepts a keyword list and separate switches for searching group IDs and group names. If both switches are disabled, there is no valid search scope.

OpenIMClient.getInstance().groupManager.searchGroups(new OnBase<List<GroupInfo>>() {
    @Override public void onSuccess(List<GroupInfo> groups) { /* groups contains the matches. */ }
    @Override public void onError(int code, String error) { /* code and error describe the failure. */ }
}, Collections.singletonList(keyword), true, true);

The current user is not necessarily a member of a group returned by searchGroups(). See Check whether the current user has joined a group to determine whether they are a member.