Custom Notifications Guide
On Android you can send a custom notification to your users. To do this, StreamLayer has implemented an extendable SLRCustomNotification class to add the overlay notification. The class elements are:
- @property title of notification
- @property description of notification
- @property layoutId when not provided default layout notification is used R.layout.slr_item_notification
- @property actionId navigation destination in the graph
- @property iconBackgroundColor background of icon color
- @property iconUrl custom icon
Once you have the above defined, use the function 'bindView(view: View)' to interact withe 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) }}You can send notification through StreamLayer.sendCustomNotification() function:
StreamLayer.sendCustomNotification(notification:SLRCustomNotification)Updated 6 months ago
