Hi,
I would like to use Automate to change several system settings (e.g. autorotation, volume, brightness) when running certain applications. If there is only one application, this seems straightforward: I can use the "App in foreground?" block with Proceed="When Changed" for a specific application. If, however, I want to do the same for additional applications, I'm not quite sure what the best approach is.
At first I thought that I could chain multiple "App in foreground?" blocks (with all but the first using Proceed=Immediately), but the "No" case runs when the specified application goes to the background, not when running applications other than the specified one.
I then tried using the "App in foreground?" block with no specified package/activity, instead having it set an output variable `cur_app`. I then connected its Yes output to an "Expression true?" block that did:
cur_app = "com.applicationA" || cur_app = "com.applicationB" || cur_app = "com.applicationC"
This works better, but I discovered that a particular application (Waze) runs itself when showing its Settings panel (which I guess is implemented as a separate activity), and this unexpectedly re-applies the changes from my flow.
I can solve that by adding more variables (i.e. by checking if the current application is different from the previous application, or keeping track of whether I already applied the changes, etc.), but this is feeling overly complicated and clunky. Is there a better way to do this?
Thanks!
- James