Question about timer (inexact)
Posted: 24 Aug 2019 15:10
I've made a small flow that will give me a notification about the air quality in my area. There are 4 options for the inexact timer trigger:
15 minutes, 30 minutes, 60 minutes, 12 hours, 24 hours.
I'd like to have the notification roughly every 45 minutes and it is not essential that my phone receives the notification (or runs the flow) until I am looking at my device or it's on. In other words, the information is not urgent. But I also don't want it to be running every time I power on my device. For battery's sake and peace of mind.
Solution 1) Add a sleep chain in the flow. If my device is powered off at the execution time, it will continue to loop until I'm back to using the device. This seems counter intuitive because Automagic needs to be using resources in the meantime to support the sleep chain?
Solution 2) Keep the inexact timer, which will set a global variable if the device is powered off. A trigger will run when the device unlocks, checking for the global variable, and run the flow.
Solution 3) Add a simple date modified check in the flow to a created file. If the flow runs when the phone is off it will touch a file and stop the flow. When the device is powered on the flow will run, check the time between now and file touch time, and then run the flow.
I am concerned about resource use in the background with these approaches. And maybe there is one that's much better? I've carefully read the way Android doze/sleep mode works, and wakes, etc. Am I just better off entirely using the inexact timer set at 30 minutes? It's kind of unnerving to receive updates about information I don't need at the moment.
Thanks!
15 minutes, 30 minutes, 60 minutes, 12 hours, 24 hours.
I'd like to have the notification roughly every 45 minutes and it is not essential that my phone receives the notification (or runs the flow) until I am looking at my device or it's on. In other words, the information is not urgent. But I also don't want it to be running every time I power on my device. For battery's sake and peace of mind.
Solution 1) Add a sleep chain in the flow. If my device is powered off at the execution time, it will continue to loop until I'm back to using the device. This seems counter intuitive because Automagic needs to be using resources in the meantime to support the sleep chain?
Solution 2) Keep the inexact timer, which will set a global variable if the device is powered off. A trigger will run when the device unlocks, checking for the global variable, and run the flow.
Solution 3) Add a simple date modified check in the flow to a created file. If the flow runs when the phone is off it will touch a file and stop the flow. When the device is powered on the flow will run, check the time between now and file touch time, and then run the flow.
I am concerned about resource use in the background with these approaches. And maybe there is one that's much better? I've carefully read the way Android doze/sleep mode works, and wakes, etc. Am I just better off entirely using the inexact timer set at 30 minutes? It's kind of unnerving to receive updates about information I don't need at the moment.
Thanks!