Trying to simplify multiple Automate flows for setting volume presets based on foreground apps

92 views
Skip to first unread message

Mad Murdock

unread,
Jul 23, 2025, 4:40:16 AMJul 23
to Automate for Android

I'm currently using seven separate flows in Automate to set the media volume to a specific level when certain apps are in the foreground (like Neutron Player, Spotify, YouTube, etc.).
I'm doing this because these apps use different internal volume steps, and setting a consistent volume level improves usability and prevents unexpected loudness.

Now I'd like to combine these flows into a single, more efficient one.

However, I still don't fully understand how to include multiple apps in the “App in foreground?” block.
I assume that within the “Output variables” of this block, I need to define something like a custom variable name under “Foreground package”, which I can then use in an expression to check if the current app matches one of the target packages.

I'm also confused whether I need to add a separate “Expression true?” block afterward (i.e., an “if” / “fx” block), and if so, what exactly I’m supposed to write there to match multiple apps.

Any help or working examples would be greatly appreciated!

I've attached screenshots of my current separate flows below, in case that helps clarify what I'm trying to achieve.


platz

Screenshot_20250723-100327.png

Screenshot_20250723-100341.png

Screenshot_20250723-100353.png

Screenshot_20250723-100405.png

Screenshot_20250723-100417.png

Screenshot_20250723-100429.png

Screenshot_20250723-100501.png

Mad Murdock

unread,
Jul 23, 2025, 12:11:08 PMJul 23
to Automate for Android
I finally figured it out. Someone on Reddit explained a similar case well:

(www.reddit.com/r/AutomateUser/comments/q5n2jq/test_for_multiple_apps_on_the_app_in_foreground/)

waiting4singularity: „app in foreground, when changed, output current package as fore
                                     expression true = contains(["com.instagram.android","com.whatsapp","com.tinder"],fore)=1

explanation: the foreground block outputs the currently focused app activity to variable. contains() returns 1 (true) if this string matches a string value in the array. on the yes path you run the stack of blocks you want and return to the foreground block, on the no path you go back to foreground directly”

I have attached a few screenshots for better understanding.

- that is the easy part:
Screenshot_20250723-172416.png
- One have just to write fore in foreground package
Screenshot_20250723-172429.png
- This is the Formula. Or at least in my case it is:
contains(["com.android.chrome","de.komoot.android","com.neutroncode.mp","com.spotify.music","org.videolan.vlc","com.google.android.youtube"],fore)=1
Screenshot_20250723-172443.png
- works like a charm
Screenshot_20250723-172453.png
-

Reply all
Reply to author
Forward
0 new messages