When evaluating the "trigger" variable inside a flow by triggering it manually it results in "Manual".
When evaluating the "trigger" variable inside a flow by triggering it by a widget, a screen testing screen-notification shows "widget Click"... yet the expression evaluates it as "Manual".
Not sure if this is a bug because i think i can see how this happens, but i think it is too unpractical.
"trigger" variable
Moderator: Martin
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
"trigger" variable
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: "trigger" variable
What elements do you use to check it? Probably you assign value "Manual" to the {trigger} by using single equal sign. In Automagic,
trigger = "Manual"
is different with
trigger == "Manual"
Single equal sign (=) is to assign value, while double equal sign (==) is to check the value and return true or false.
I have expression to check for widget click in several flows, and it never fail me to be evaluated as "Manual".
trigger = "Manual"
is different with
trigger == "Manual"
Single equal sign (=) is to assign value, while double equal sign (==) is to check the value and return true or false.
I have expression to check for widget click in several flows, and it never fail me to be evaluated as "Manual".
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: "trigger" variable
I use my expression with double equal sign (==) to ensure to compare the values rather than assign a value.Desmanto wrote:What elements do you use to check it? Probably you assign value "Manual" to the {trigger} by using single equal sign. In Automagic,
trigger = "Manual"
is different with
trigger == "Manual"
Single equal sign (=) is to assign value, while double equal sign (==) is to check the value and return true or false.
I have expression to check for widget click in several flows, and it never fail me to be evaluated as "Manual".
What i use is simply:
Expression# 1: if (startsWith(trigger, "Manual") {return true} else return false; ....etc
Expression# 2: if (startsWith(trigger, "Widget") {return true) else return false; .....etc
Whether i execute the flow manually or by using the widget, it never reach Expression#2.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: "trigger" variable
It is too long. You can check the trigger just by the ==.
Expression 1 :
in parallel with Expression 2 :
Both expression will return true or false depends on the result of evaluation.
Try to add condition Debug Dialog to expression 1 to see the value of the trigger.
You can check my index why we should use parallel, search for "Multiple Choice".
Expression 1 :
Code: Select all
trigger == "Manual"
Code: Select all
trigger == "Widget Click"
Try to add condition Debug Dialog to expression 1 to see the value of the trigger.
You can check my index why we should use parallel, search for "Multiple Choice".
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: "trigger" variable
Thanks Desmanto
I should have linked the expressions parallel instead of serial to look at both values.
I kind of got away from that method because i saw an aweful lot of re-doing actions when parallel linking. I think i know why too now.
I should have linked the expressions parallel instead of serial to look at both values.
I kind of got away from that method because i saw an aweful lot of re-doing actions when parallel linking. I think i know why too now.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)