Notification on Statusbar, Actions with parameters

Post your questions and help other users.

Moderator: Martin

Post Reply
porten
Posts: 7
Joined: 01 May 2013 10:56

Notification on Statusbar, Actions with parameters

Post by porten » 12 Mar 2015 07:51

Hi

I use the Notification on Statusbar action type, and would like to add actions (buttons) to the notification, where the button-text, and also the button-action itself, is derived from parameters.

Example notification:
Message="Missed call from {phone_number}"
Action icon: Call
Action text: "Call {phone_number}"
Action to execute: Call Number: {phone_number}

So long as {phone_number} is a present variable, my notification looks correct. The phone number is present on the message, and on the notification action-button itself. But when I actually click the button to execute the Call Number action, it is passed an empty string so the phone attempts to dial an empty number. It looks like parameters are not supported for notification button "action input".

Tested on HTC One M7 running Automagic Premium 1.27.0 / Android 5.0.2 / HTC Sense 6.0.
Attachments
Screenshot_2015-03-12-08-43-29.png
Screenshot showing the notification configuration, except with {sms_recipient} variable.
Screenshot_2015-03-12-08-43-29.png (239.4 KiB) Viewed 8782 times

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Notification on Statusbar, Actions with parameters

Post by Martin » 13 Mar 2015 19:24

Hi

You are right, passing variables to an action is currently not supported. You could store the variable temporarily in a global variable so the action can access the variable when it's executed. This has the disadvantage that it will not work properly when you are using the same global variable in multiple actions or multiple notifications.

You could also use the label to pass the value to the call action.
Label of the action would stay: Call {phone_number}
The action would become:
Call Number: {substring(action_text, 4)}
The variable action_text contains value Call 12345, function substring extracts the part after Call .

Theoretically it should be possible to extend Automagic so that variables can be passed directly to the action. Let me add this to the todo-list.

Regards,
Martin

porten
Posts: 7
Joined: 01 May 2013 10:56

Re: Notification on Statusbar, Actions with parameters

Post by porten » 14 Mar 2015 15:18

Cool, the action_text substring workaround does the trick for me. Thanks a lot and keep up the great work!

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Notification on Statusbar, Actions with parameters

Post by Martin » 15 Mar 2015 11:52

Passing variables to the executed actions should work in the next EAP-version which should be released in about a week or two in the EAP-forum.

Post Reply