SDKsAndroid
Search groups
Search local group records by keywords matching group ID or group name using searchGroups().
Search local group records by keywords matching group IDs or group names. Configure individual boolean toggles to enable or disable search targets.
Code example
List<String> keywordList = Collections.singletonList("Engineering");
boolean isSearchGroupID = true;
boolean isSearchGroupName = true;
OpenIMClient.getInstance().groupManager.searchGroups(
new OnBase<List<GroupInfo>>() {
@Override
public void onSuccess(List<GroupInfo> groups) {
// groups contains matching group records
}
@Override
public void onError(int code, String error) {
// Handle search failure
}
},
keywordList,
isSearchGroupID,
isSearchGroupName
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<List<GroupInfo>> | Yes | Callback delivering the asynchronous operation result. |
keywordList | List<String> | Yes | List of query keyword strings. Avoid querying with empty keywords or when both toggles are false. |
isSearchGroupID | boolean | Yes | Whether to search against group IDs: true to include, false to exclude. |
isSearchGroupName | boolean | Yes | Whether to search against group names: true to include, false to exclude. |
Return value
The successful callback returns a List<GroupInfo> containing all matching group records.
Search results reflect a local matching snapshot at query execution time. Returned groups do not necessarily indicate that the user has joined them; to verify membership, call Check group membership.
Was this page helpful?