Chat in an open channel
An open channel is a public chat that allows a massive number of users to interact with one another in a more dynamic environment. Open channels can accommodate up to 1,000 simultaneous users and don’t require an invitation for users to enter.
Open channel screen
An open channel screen is composed of four components: header, message list, message input, and message list status.
The header component shows the title of the open channel screen, which is the open channel name. It also has two buttons on the left and right corner of the component. When the left button is tapped, the
finish() method of the activity is called to exit the current screen. When the right button is tapped, the open channel settings screen appears for operators and the participant list screen appears for channel participants. The view of the channel header is created and customized in the
OpenChannelHeaderComponent of the
The message list component shows a list of all messages exchanged in the open channel in a chronological order. The list shows both text and file messages and messages sent by the current user are differentiated from those sent by other channel participants. The view of the message list is created and customized in the
OpenChannelMessageListComponent of the
OpenChannelModule. You can also customize each item in the list view using
The message input component is where the user can either enter a text message or send a file message by importing a file, image or video. The view of the message input is created and customized in the
OpenChannelMessageInputComponent of the
Message list status
The message list status component shows the result of the data request for a message list. The
StatusComponent exists in the
OpenChannelModule and lets the user know if the list is loading or if the list could not be called.
UIKit for Android provides both activity and fragment to create an open channel screen. You can choose which one to build your app with and you may solely use activity instead of fragment if you wish to. You can build an open channel screen through
OpenChannelActivity, which uses
UIKitFragmentFactory to create views.
Start an activity
To enter the chat screen, a
channel_url is required as a unique identifier for the channel. You can find this URL from the
url property of the
OpenChannel, or find it on your Sendbird Dashboard. Begin a channel activity using
intent which transitions you from the current activity to
OpenChannelActivity as shown in the example below.
Create a fragment
OpenChannelActivity allows you to create a basic
UIKitFragmentFactory has a set of methods that build each fragment, whereas the builder class provides APIs to customize the UI of the data and event handlers used in
OpenChannelFragment. To see all APIs of
OpenChannelFragment.Builder, refer to the API reference page.
Note: To use UIKit's fragments as a nested fragment, refer to the Android Developer Documentation's Nested Fragments.
In the open channel key function, you can customize
OpenChannelFragment to change different aspects of the screen. The
OpenChannelFragment.Builder class allows you to create and customize the basic
OpenChannelFragment that UIKit provides but you can only change its own APIs, such as setting a layout. If you wish to customize the fragment beyond using the APIs provided in the builder, you must inherit new customization methods.
The following table shows the main classes used in
OpenChannelFragment to display and customize the open channel screen.
Depending on the UI or the feature you wish to customize in the fragment, you can change the classes mentioned in the table. To learn how to customize the fragment, see the Customizations overview page for further details.
Note: The links to the above customization pages provide an example of how to customize classes related to
ChannelFragment. In order to make changes to the open channel, you must use the correct classes.