Browse SDKs · Android
Platform
SDKsAndroid

Set in-group friending permission

Control whether members can send friend requests to each other from within a group using setGroupInfo().

Copy

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:

ModeValueDescription
Disallow in-group friending0Disallows members from sending friend applications to each other from this group.
Allow in-group friending1Allows members to send friend applications normally from group profile cards.

Parameters

ParameterTypeRequiredDescription
groupInfoGroupInfoYesGroup entity holding the target groupID and the updated applyMemberFriend integer.
baseOnBase<String>YesCallback 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.