Chat / Android
Chat Android v4
Chat Android
Chat
Android
Home
/
Chat
/
Android
/
Channel
This is the new Docs for Chat SDK v4 for Android. To see the previous Docs, click here.

Categorize channels by custom type

When creating an open channel or a group channel, you can additionally specify a custom channel type to subclassify channels. This custom type takes on the form of String, and can be useful in searching or filtering channels.

The data and customType properties of a channel object allow you to append information to channels. While both properties can be used flexibly, common examples for customType include categorizing channels as "School" or "Work".

Open channel

To get an open channel's custom type, read the openChannel.customType property.

val params = OpenChannelCreateParams().apply {
    name = NAME
    coverUrl = COVER_IMAGE_URL
    data = DATA
    operators = OPERATOR_USERS
    customType = CUSTOM_TYPE
}
OpenChannel.createChannel(params) { channel, e ->
    if (e != null) {
        // Handle error.
    }

    // ...
}

Group channel

To get a group channel's custom type, read the groupChannel.customType property.

val users = listOf("Tyler", "Nathan")
val params = GroupChannelCreateParams().apply {
    userIds = users
    name = NAME
    customType = CUSTOM_TYPE
}
GroupChannel.createChannel(params) { channel, e ->
    if (e != null) {
        // Handle error.
    }

    // ...
}