Notification channel
There are two different views when rendering notification channels: Feed and Chat. Feed view shows all notifications in a list form while Chat view shows notifications in the form of a user-to-user group channel.
Feed vs. Chat
The following table lists the differences between Feed view and Chat view.
Feed | Chat | |
---|---|---|
UI | A list view that contains a new notification badge. | A channel view that contains a channel image and timestamp for each notification. |
Order of notifications | The most recent notification is displayed at the top. | The most recent notification is displayed at the bottom. |
Shown in channel list view | No | Yes, it's included in the channel list view along with other group channels. |
Feed view
A Feed view of the notification channel is composed of three components: header, notification list, and notification list status.
Components
Header
The header component shows the title of the notification channel.
Notification list
The notification list component shows a list of all notifications sent to the user.
Notification list status
The notification list status component shows the result of the data request for a notification list.
Usage
Chat UIKit Android for Notifications provides both activity and fragment to create a Feed view. 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 a Feed view through FeedNotificationChannelActivity
, which uses UIKitFragmentFactory
to create views. The channel URL of the Feed notification channel can be found on Sendbird Dashboard under Notifications > Channels.
Start an activity
You can start an activity by using intent
to move from one activity to FeedNotificationChannelActivity
as shown below:
Create a fragment
FeedNotificationChannelActivity
allows you to create a basic FeedNotificationChannelFragment
through UIKitFragmentFactory
and FeedNotificationChannelFragment.Builder
. 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 FeedNotificationChannelFragment
.
Note: To use the UIKit's fragments as a nested fragment, refer to the Android Developer Documentation's Nested Fragments.
Configure new notification badge
A green badge appears above the notification bubble when the current user receives a new notification in the Feed view. This badge is displayed based on the feed's last read time value at the time of view creation. However, this time value remains the same while the Feed view is on foreground, which prevents the badge from disappearing even if the user's already seen the notification. If you want to update the last read time value, see the code below.
Refresh notification collections
If you've authenticated to the Sendbird server by calling SendbirdUIKit.authenticateFeed()
, there's no WebSocket connection between the UIKit and the Sendbird server. Due to the lack of connection, the UIKit can't receive real-time events to notify the user with updated information about the feed channel.
The UIKit will automatically refresh the notification collections when the client app is brought to foreground or when the device's network connection has changed. In the case that the collection information is received as a push notification from the client app, you can refresh the content of all valid notification collections.
Note:
NotificationCollection
is valid only if theisLive
flag is set totrue
.
Chat view
A Chat view of the notification channel is composed of three components: header, notification list, and notification list status.
Components
Header
The header component shows the channel title, channel image, and a back button that takes the user to the previous view.
Notification list
The notification list component shows a list of all notifications.
Notification list status
The notification list status component shows the result of the data request for a notification list.
Usage
Chat UIKit Android for Notifications provides both activity and fragment to create a Chat view. 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 a Chat view through ChatNotificationChannelActivity
, which uses UIKitFragmentFactory
to create views. The channel URL of the Chat notification channel can be found on Sendbird Dashboard under Notifications > Channels.
Start an activity
You can start an activity by using intent
to move from one activity to ChatNotificationChannelActivity
as shown below:
Create a fragment
ChatNotificationChannelActivity
allows you to create a basic ChatNotificationChannelFragment
through UIKitFragmentFactory
and ChatNotificationChannelFragment.Builder
. 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 ChatNotificationChannelFragment
.
Note: To use the UIKit's fragments as a nested fragment, refer to the Android Developer Documentation's Nested Fragments.