by Jeremy A
Enables high accuracy location when at least one of the apps in the array 'packages' is running, disables when all the apps in the array are killed
More apps can be added to the flow by adding another element to the array at the start of the flow, but the superuser command block must be amended to include every entry in 'packages', by adding
++ " " ++ packages[index]
for every app you have added.
"ps | grep" and "pgrep" no longer seem to work on Nougat (and possibly Oreo) so I have used the "pidof" command to check which of the selected apps are running (i.e. not killed). If the command cannot find PIDs for the apps given to the command, it returns an exit code of 1, which can be interpreted as 'none of the apps are running'.
NB: Location should be set to battery saving before starting this flow!