Interface NotificationHandler
-
- All Implemented Interfaces:
public interface NotificationHandlerHandler responsible for showing and dismissing notification. Implement this interface and use ChatClient.Builder.notifications if you want to customize default behavior
-
-
Method Summary
Modifier and Type Method Description BooleanonChatEvent(NewMessageEvent event)Handles showing notification after receiving NewMessageEvent from other users. BooleanonPushMessage(PushMessage message)Handles showing notification after receiving PushMessage. abstract UnitshowNotification(Channel channel, Message message)Show a notification for the given channel and message abstract UnitdismissChannelNotifications(String channelType, String channelId)Dismiss notifications from a given channelType and channelId. abstract UnitdismissAllNotifications()Dismiss all notifications. abstract UnitonNotificationPermissionStatus(NotificationPermissionStatus status)Handles android.Manifest.permission.POST_NOTIFICATIONS permission lifecycle. -
-
Method Detail
-
onChatEvent
Boolean onChatEvent(NewMessageEvent event)
Handles showing notification after receiving NewMessageEvent from other users. Default implementation loads necessary data and displays notification even if app is in foreground.
- Returns:
False if notification should be handled internally.
-
onPushMessage
Boolean onPushMessage(PushMessage message)
Handles showing notification after receiving PushMessage. Default implementation loads necessary data from the server and shows notification if application is not in foreground.
- Returns:
False if remote message should be handled internally.
-
showNotification
abstract Unit showNotification(Channel channel, Message message)
- Parameters:
channel- where the new message was postedmessage- was received
-
dismissChannelNotifications
abstract Unit dismissChannelNotifications(String channelType, String channelId)
Dismiss notifications from a given channelType and channelId.
- Parameters:
channelType- String that represent the channel type of the channel you want to dismiss notifications.channelId- String that represent the channel id of the channel you want to dismiss notifications.
-
dismissAllNotifications
abstract Unit dismissAllNotifications()
Dismiss all notifications.
-
onNotificationPermissionStatus
abstract Unit onNotificationPermissionStatus(NotificationPermissionStatus status)
Handles android.Manifest.permission.POST_NOTIFICATIONS permission lifecycle.
- Parameters:
status- Represents current android.Manifest.permission.POST_NOTIFICATIONS permission status.
-
-
-
-