Need advice on how to handle cross-flow conditions

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
Scott
Posts: 24
Joined: 12 Dec 2015 00:09

Need advice on how to handle cross-flow conditions

Post by Scott » 20 Jan 2016 19:50

I have several flows that speak and/or play sound files under certain conditions. However, as I refine my setup, I want to prevent speech/sound output under certain conditions. For example, I have flows that announce the time every hour, but I do not want them to do so if I am playing a full-screen game, or using Maps, or if I am listening to music (i.e. headset connected).

I have started setting up the conditions in each separate flow, but this is tedious and problematic, because it's easy to forget to modify a certain thing in a given flow, or even to modify a given flow entirely. There are quite a few apps that I do not want interrupted, for one thing.

A thought I had was to set a global variable in a standalone flow (e.g. if a "blacklisted" app is running or if a headset is connected), and have the other flows check the status of that variable. I guess I would need another flow to turn the variable back off when the conditions were no longer true as well, or perhaps the same flow could sleep/loop instead for that purpose.

Could someone please advise on the best approach to use for this? It's probably obvious that I'm not an advanced Automagic user, so the more detail, the better.
Samsung Galaxy S9+ (unrooted and cannot/will not root), Android 9.0
Latest stable Automagic version, always

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: Need advice on how to handle cross-flow conditions

Post by Wibbly » 21 Jan 2016 13:38

I would use your global variable approach myself. Easier to maintain as you only have one (or two) flows to edit the list of blacklisted apps.

I do something similar for flows to react to locations. I have global variable to represent the location and a flow that determines how that variable is set. Also has the advantage that I can trigger on that variable changing, as well as testing it in a condition :-)

Post Reply