Create a conversation notification

Learn how to create a notification that displays a list of texts that can easily be added to

  1. joaomgcd
    For a concrete example usage of this, check out this project.

    Ok, so what is a conversation notification? It's just a simple way of saying notification with a title and a bunch of lines that are stacked vertically, where each line can have an icon and and optional image.

    It looks like this:

    [​IMG]

    The content can be whatever you like! :)
    Note: Icons and images are only supported on Android 9 or above. Earlier Android versions will not show them.

    STEP 1 - INITIAL CONVERSATION


    Let's start by creating a new conversation notification

    • Create a new Task in Tasker
    • Name it Sample Conversation
    • Add a Status Bar action and set it to Expanded just so you can more easily see the notifications you'll create
    • Add an AutoNotification action
    • Set the Id to conversation
    (i) It's important to set the Id because you'll need that to add more lines to the conversation later.
    • Set the Title to This is a conversation
    • In the Conversation section, set the Names to Someone
    • Set the Texts to Hello
    • Back out and run the action



    You should now get a basic notification with just the line you added.

    STEP 2 - UPDATING CONVERSATION


    • Add a new AutoNotification action
    • Set the Id to the same as above: conversation
    • Enable the Update option, so that the same notification is updated
    • Set the Conversation Names to Other
    • Set the Texts to Hi to you too
    • Back out and run the Task


    As you can see you now have a 2 line conversation. Because you didn't set any icons, they default to the initials of each person's name.

    STEP 3 - MULTIPLE RESPONSES FROM SAME PERSON


    • Copy-paste the action from step 2 but set the Texts to How are you today?
    • Back out and run


    As you can see, responses by the same person will be grouped together, making it look very natural.

    STEP 4 - MORE PEOPLE JOIN IN


    Let's add 2 more people to the conversation: Dudette and Dude

    • Copy-paste the action from step 2 but set the Names to Dudette,Dude and the Texts to We're here too!,Yes we are!
    • Back out and run the task


    As you can see you can add more than one conversation at a time.

    STEP 5 - ADDING ICONS


    In a conversation, an icon belongs to a person. You only need to set the icon once, and AutoNotification will remember the icon you used for that person, in that conversation.

    Simply go in each action and add the icons you want for each person.

    In the example I simply added random app icons to each person.

    Note how in the action where I added 2 people to the conversation, I added 2 icons as well.


    STEP 6 - YOURSELF


    If you want, you can also manually insert lines in the conversation. For that you need to enable the reply action.

    • Edit the first AutoNotification action
    • Set the Reply Action to replyconversation (this is just some unique command, can be anything you want really. You just have to match it in the profile we'll create later)
    • Set the Reply Label to Reply (again, can be anything you want)
    • Optionally set a list of comma separated choices that you want to appear on the notification so you can easily add those to the conversation. Set it to Ok,No,Bye,Later
    • Go back and run the task


    As you can see you appear as "Me" by default. Also, when you add something to the conversation a spinner comes up and keeps spinning. Let's take care of that.

    STEP 7 - ADDING YOUR REPLIES


    • Make sure the notification you created above is showing
    • Go back to Tasker and create a new profile with the AutoNotification condition
    • Set the Command Filter to replyconversation (the same you set Reply Action to before)
    • Accept it and create a task
    • Create a new AutoNotification action and set the Id to conversation (same as above) and enable the Update option so that the same notification is updated
    • In the Conversation section, set Names to João and Texts to %ancomm (this is the actual reply that was sent by you)
    • Back out of Tasker to save
    • Add replies to the notification


    As you can see replies are added and the spinner disappears.
    But if you notice, something is still a little off: the person still appears as Me for a bit, only to be updated with the João person after our profile kicks in.

    This happens because when you add something to the conversation, Android automatically adds it with the person as defined in your Own Info in the AutoNotification action. Since you didn't set values there, the default values were used.

    If we customize the Own Info values, we can overcome that. Let's do that now.

    STEP 8 - SETTING YOUR OWN INFO


    • Go back into the first AutoNotification action you created in the Sample Conversation task
    • Go in the Conversation section and set your Own Name and Own Icon values to João and an icon you want.
    • Run this task to create a fresh notification with this info added.
    • Open the task you associated with the profile you created on step 7, edit the AutoNotification action and set the Conversation Icons to the same icon you set in the Own Icon field above
    • Back out of Tasker to save


    If you now add stuff to the conversation, you'll always see the correct icon, both when the spinner is showing, and after the notification is updated :cool:

    Again, you can get a complete implementation of this by importing a project here.