Set in-group friending permission
Control whether members can send friend requests to each other from within a group using setGroupInfo().
Control whether group members can initiate friend applications to one another directly from the group roster. Group owners and administrators toggle this policy using the applyMemberFriend property on GroupInfo. This restriction specifically governs the friend request entry point in group member cards.
Code example
GroupInfo update = new GroupInfo();
update.setGroupID("group_123");
update.setApplyMemberFriend(0); // 0 disallows members from adding each other as friends
OpenIMClient.getInstance().groupManager.setGroupInfo(
update,
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// Permission updated successfully
}
@Override
public void onError(int code, String error) {
// Handle update failure
}
}
);Permission values
The applyMemberFriend field accepts the following integers:
| Mode | Value | Description |
|---|---|---|
| Disallow in-group friending | 0 | Disallows members from sending friend applications to each other from this group. |
| Allow in-group friending | 1 | Allows members to send friend applications normally from group profile cards. |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupInfo | GroupInfo | Yes | Group entity holding the target groupID and the updated applyMemberFriend integer. |
base | OnBase<String> | Yes | Callback delivering the asynchronous operation result. |
Return value
The successful callback confirms that the permission setting was saved on the server.
State changes after the call
Once updated, group members receive the onGroupInfoChanged(GroupInfo group) event via OnGroupListener. Merge the updated GroupInfo using groupID, and hide or disable "Add friend" buttons on member profile cards. For complete listener registration details, see Group overview.
Was this page helpful?