UPDATE: I figured this out. I didn't know I had to declare global_ variables under the "manage" part of the application. Once I created it there, I could easily get and set it in my flow. That resolved my issue perfectly. However, I do have a question regarding global variables - do their values get retained when the phone is restarted and/or the flows applications is restarted?
I have written a flow that checks the time range so that my phone ringer is silenced during the night. It triggers every 15m and checks the time range between 12am and 6am. If true, it sets the ringer to silence. Otherwise, it sets the ringer to normal. It works great, but the other day I had to turn my ringer off manually (set it to vibrate). Later, went I went to turn my ringer back on I realized that the flow had already turned it back on because I was not within that time range of my flow.
I'm not sure how to resolve this issue. I need to know if I turned the ringer off manually or via the flow. Basically if I set the ringer to vibrate or silent manually I want it to remain in that state and not have the flow change it on me (unless the time range condition is true).
My initial trials have been to set/use a variable in my flow when I silence the ringer (something like silent=1 or global_silent=1). Then when the flow triggers again, I could check that variable in other another condition/expression. Problem is that I can't see that variable I set (in a script) using either global_silence=1 or just simply n=1. It's not showing up for me to use in my condition check. If I force the flow to go back up to the condition after setting the variable, it causes a loop condition and the flow is automatically terminated.
How can I achieve what I want? Any information would be greatly appreciated.
Best Regards,
DataCrypt
Ringer status
Moderator: Martin
Re: Ringer status
Global variables are saved in a file (/sdcard/Automagic/variables.bin) and are reloaded when you stop/restart the Automagic service or the phone.
Another option to change the ringer mode is to use two flows, one flow to turn the ringer to silent and one flow to turn the ringer back to normal.
Something like this:
Flow 1
-Trigger "Time: 12am"
-Trigger "Set Ringer Mode: Silent"
Flow 2
-Trigger "Time: 6am"
-Trigger "Set Ringer Mode: Normal"
This has the advantage that it does not change the ringer setting every 15m when you manually change the ringer mode and the flows use slightly less battery since it does not wake your device from sleep every 15 minutes.
Regards,
Martin
Another option to change the ringer mode is to use two flows, one flow to turn the ringer to silent and one flow to turn the ringer back to normal.
Something like this:
Flow 1
-Trigger "Time: 12am"
-Trigger "Set Ringer Mode: Silent"
Flow 2
-Trigger "Time: 6am"
-Trigger "Set Ringer Mode: Normal"
This has the advantage that it does not change the ringer setting every 15m when you manually change the ringer mode and the flows use slightly less battery since it does not wake your device from sleep every 15 minutes.
Regards,
Martin