Browse SDKs · Android
SDKsAndroid

Leave a group

Use the Android SDK to remove the current signed-in user from a group.

Copy

quitGroup() only removes the current signed-in user. It does not dismiss the group or remove other members.

OpenIMClient.getInstance().groupManager.quitGroup(new OnBase<String>() {
    @Override public void onSuccess(String data) { /* The request completed. */ }
    @Override public void onError(int code, String error) { /* code and error describe the failure. */ }
}, groupID);

A successful callback means that the leave request completed; it does not mean that the group-list event has arrived. onJoinedGroupDeleted provides the departed group's GroupInfo. Remove it from the current user's group list by groupID. See Group overview for the complete listener setup.