SDKsAndroid
Mute or unmute a group member
Use the Android SDK to set the mute duration for a specified group member.
Set the mute duration for a specified group member or unmute them. Group owners and administrators can mute a member for a specified number of seconds; passing 0 seconds removes the mute immediately. This setting applies solely to the individual member and operates independently of Mute or unmute a group.
Code example
String groupID = "group_123";
String userID = "user_b";
long seconds = 3600L; // Mute for 1 hour; pass 0L to unmute
OpenIMClient.getInstance().groupManager.changeGroupMemberMute(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// Member mute status updated successfully
}
@Override
public void onError(int code, String error) {
// Failed to update member mute status
}
},
groupID,
userID,
seconds
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<String> | Yes | Callback handler for the asynchronous request. |
groupID | String | Yes | Globally unique ID of the target group. |
userID | String | Yes | User ID of the target group member. |
seconds | long | Yes | Mute duration in seconds. Pass 0 to unmute the member. |
Return value
Upon success, data in onSuccess returns a confirmation message.
State changes after the call
- Callback confirmation: The
onSuccesscallback confirms that the mute status was persisted on the server. - Asynchronous event delivery: Members in the group receive the
onGroupMemberInfoChangedevent delivering the updatedGroupMembersInfowith the newmuteEndTimetimestamp. The client should merge this state into the cached member record usinggroupID:userIDas the unique key. - Re-query calibration: If mute expiration or state falls out of sync, call Get group member profiles to reload member data.
For complete listener registration and lifecycle management, see Group overview.
Was this page helpful?