AutoNotification Custom SMS Notification and Button/Touch Actions

Discussion in 'AutoApps' started by ejf071189, Sep 22, 2017.

  1. ejf071189

    ejf071189 Member

    Joined:
    Jan 18, 2017
    Messages:
    32
    Likes Received:
    0
    I want to have an additional button on my notifications from the Android Messages app and after researching, am under the impression that the best way to do this is to intercept the default notification, pull its data, cancel it, and create a new notification with the pulled data and actions and add the additional button.
    I tried doing this, and it looks like everything is pulling in correctly, but when I click the buttons (mark as read and reply) or the notification itself, nothing happens. I am able to run the actions by just using AN > Action and everything works fine, but through the notification generated by AN, it doesn't work and I'm having trouble figuring out why.
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Maybe this helps?
     
  3. ejf071189

    ejf071189 Member

    Joined:
    Jan 18, 2017
    Messages:
    32
    Likes Received:
    0
    I'm not sure that would apply to me since I'm on Android 6.X
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    The same principle applies for notification buttons :) That example uses the reply action but if you use button actions it should work!
     
  5. ejf071189

    ejf071189 Member

    Joined:
    Jan 18, 2017
    Messages:
    32
    Likes Received:
    0
    Yes that's what I did as far as I know. Here's what I relevant configs I have for the Autonotification action in tasker:
    Action on Touch: %antouchaction
    Action on Dismiss: %andismissaction
    Dismiss on Touch: true
    Button 1: %anbutton1action
    Label 1: %anbutton1text
    Button 2: %anbutton2action
    Label 2: %anbutton2text

    And right now touching the notification dismisses it with no additional action, and touching the buttons does nothing.
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    You also have to implement a profile that intercepts those and performs the actions.
    For example, change Action on Touch to
    Code (Text):
    anaction=:=%antouchaction
    Then have an AutoApps Event profile with the command filter set to anaction=:= and in the task use the AutoNotification Actions action to perform the action :)
    Hope this helps!
     
  7. ejf071189

    ejf071189 Member

    Joined:
    Jan 18, 2017
    Messages:
    32
    Likes Received:
    0
    Aha, thanks for the tip!
    This is now 90% working, with the exception of getting the notifications to cancel after performing the button actions.
    Right now, I have the %anid of the original notification being saved as the notification id for the created (duplicate) notification (as opposed to the %importantWhatsapp variable used in the example). This same ID is passed as one of the anaction=:= variables for the Autoapps command event, and then in the associated task I have an AutoNotfication cancel action that uses that ID. Is there a problem with using the same ID as the original notification in the duplicate? If so, what should be used as an alternative?
     
  8. ejf071189

    ejf071189 Member

    Joined:
    Jan 18, 2017
    Messages:
    32
    Likes Received:
    0
    Ok apparently this was fixed by just changing my use of the variable name "id" in the autoapps command to something like "notid". Not sure if "id" is some kind of protected variable.
     

Share This Page