createNotificationHandler

fun createNotificationHandler(context: Context, notificationConfig: NotificationConfig, newMessageIntent: (message: Message, channel: Channel) -> Intent = getDefaultNewMessageIntentFun(context), notificationChannel: () -> NotificationChannel = getDefaultNotificationChannel(context), userIconBuilder: UserIconBuilder = provideDefaultUserIconBuilder(context), permissionHandler: NotificationPermissionHandler? = provideDefaultNotificationPermissionHandler(context), notificationTextFormatter: (currentUser: User?, message: Message) -> CharSequence = getDefaultNotificationTextFormatter(notificationConfig), actionsProvider: (notificationId: Int, channel: Channel, message: Message) -> List<NotificationCompat.Action> = getDefaultActionsProvider(context), notificationBuilderTransformer: (NotificationCompat.Builder, ChatNotification) -> NotificationCompat.Builder = { builder, _ -> builder }, onPushMessage: (pushMessage: PushMessage) -> Boolean = { false }, notificationIdFactory: NotificationIdFactory? = null): NotificationHandler

Method that creates a NotificationHandler.

Return

A NotificationHandler instance.

Parameters

context

The Context to build the NotificationHandler with.

notificationConfig

Configuration for push notifications.

newMessageIntent

Lambda expression used to generate an Intent to open your app

notificationChannel

Lambda expression used to generate a NotificationChannel. Used in SDK_INT >= VERSION_CODES.O.

userIconBuilder

Generates IconCompat to be shown on notifications.

permissionHandler
notificationTextFormatter

Lambda expression used to formats the text of the notification.

actionsProvider

Lambda expression used to provide actions for the notification. See NotificationActionsFactory for customizing the default actions.

notificationBuilderTransformer

Lambda expression used to transform the NotificationCompat.Builder before building the notification.

onPushMessage

Lambda expression called when a new push message is received. Return true if the push message was handled and no further processing is required.

notificationIdFactory

Custom factory for generating notification IDs based on ChatNotification. If null or if NotificationIdFactory.getNotificationId returns null, the SDK will use its default notification ID generation logic. Use this to customize how notifications are grouped.

See also