Delete channels
ChatUI includes built-in delete functionality in the channel long-press menu.

To customize the delete logic, use the nexconn public API.
Delete a specific channel
Remove the channel from the channel list (does not delete message content).
- Kotlin
- Java
kotlin
val identifier = ChannelIdentifier(ChannelType.DIRECT, "user_001")
val channel = NCChatUI.createChannel(identifier)
channel.delete { result, error ->
// result == true and error == null indicates success
}
Java
ChannelIdentifier identifier = new ChannelIdentifier(ChannelType.DIRECT, "user_001");
BaseChannel channel = NCChatUI.createChannel(identifier);
channel.delete((result, error) -> {
// result == true and error == null indicates success
});
Delete channels in batch
- Kotlin
- Java
kotlin
val ids = listOf(
ChannelIdentifier(ChannelType.DIRECT, "user_001"),
ChannelIdentifier(ChannelType.GROUP, "group_001")
)
BaseChannel.deleteChannels(ids) { result, error ->
// result == true and error == null indicates success
}
Java
List<ChannelIdentifier> ids = Arrays.asList(
new ChannelIdentifier(ChannelType.DIRECT, "user_001"),
new ChannelIdentifier(ChannelType.GROUP, "group_001"));
BaseChannel.deleteChannels(ids, (result, error) -> {
// result == true and error == null indicates success
});
tip
Deleting a channel does not automatically clear its message history. To remove messages, call the message delete API. For details, see Delete messages.