Skip to content

Create a flow of notifications with custom actions that collect a rapid feedback from the user.

License

Notifications You must be signed in to change notification settings

chattylabs/interactive-notification

Repository files navigation

TYPE VERSION STATUS COVERAGE
demo demo Latest demo Build Status Coverage Status
interactive-notification library Latest version Build Status Coverage Status

Check: VUI SDK

This is an implementation on top of the current Android Notification component that allows you to build a flow of notifications and provides new customizable actions that can collect a rapid feedback from the user.

Why choosing this library?

  • No need to expand the notification to perform an action
  • Action events work even when the device is locked
  • Get a quick feedback by placing actions at right or at bottom
  • Use either emojis or text for the action buttons
  • You can customize the actions and message styles
  • Add various actions with different sizes each

Prerequisites

The SDK works on Android version 5.0 (Lollipop) and above. (for lower versions contact us)

Dependencies

repositories { 
    
    // Optional. Access to early versions not yet published.
    maven { url "https://dl.bintray.com/chattylabs/maven" }
}

dependencies {

    // Required
    implementation 'com.chattylabs.sdk.android:interactive-notification:<latest version>'
}

How to create a Notification flow?

The following is an example on how you can create a flow with 2 notifications.
You can apply configurations to the actions like sorting or resizing.

val component = InteractiveNotificationModule.provideComponent(...)
 
component.setReceiver(MyBroadcastReceiver::class.java)
 
with(component) {
    cancel()

    // Add a first Notification + Actions
    addNode(Message("message_id_1", "Any first random message question?"))
    addNode(Action("action_ok", "\uD83D\uDC4D", 0, 16f)) // 👍
    addNode(Action("action_ko", "\uD83D\uDC4E", 1, 16f)) // 👎

    // Add a second Notification + Actions
    addNode(Message("message_id_2", "Any second random message question?"))
    addNode(Action("action_yes", "Yes", 1, 16f))
    addNode(Action("action_no",  "No",  0, 16f))

    // Set the notification ID
    with(prepare(100)) { 

        // Build the flow
        from("message_id_1").to("action_ko", "action_ok")

        from("action_ok").to("message_id_2")

        // By default, if the user taps on "action_ko" (or any action without a relation)
        // the flow stops and the notification is dismissed

        from("message_id_2").to("action_yes", "action_no")
        
        // Start showing the first notification
        start(getNode("message_id_1"))
    }
}

 

About

Create a flow of notifications with custom actions that collect a rapid feedback from the user.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published