Custom Notifications Guide
Send custom in-app notifications in the StreamLayer Android SDK. Use SLRCustomNotification to create and display custom notification layouts with configurable icons, titles, and navigation destinations.
Custom Notifications Guide
You can send custom in-app notifications through the StreamLayer Element. Extend the SLRCustomNotification class to define your notification. The class properties are:
title— notification titledescription— notification descriptionlayoutId— custom layout resource (defaults toR.layout.slr_item_notificationif not provided)actionId— navigation destination IDiconBackgroundColor— background color for the iconiconUrl— custom icon URL
Override bindView(view: View) to interact with the view or set the view data manually:
class DemoNotification(
override val title: String? = null,
override val description: String? = null,
override val layoutId: Int? = R.layout.layout_notification,
override val actionId: Int? = R.id.action_custom_3,
override val iconBackgroundColor: Int? = null,
override val iconUrl: String? = null,
val viewIteractor: ((View) -> Unit)? = null
) : SLRCustomNotification(title, description, layoutId, actionId, iconBackgroundColor, iconUrl) {
override fun bindView(view: View) { viewIteractor?.invoke(view) }}Send the notification through StreamLayer.sendCustomNotification():
StreamLayer.sendCustomNotification(notification:SLRCustomNotification)Related
- Custom Menu Items — Add custom entries to the StreamLayer menu
- UI Options Guide — Comprehensive
SLRAppHostconfiguration reference
Updated 21 days ago
