Just install the magisk module - Busybox for Android NDK. You can use the it for other purpose later.
To get the package name of the app, you can use MiXplorer from xda, at the app manager, you can see the packagename. You can copy the whole metadata of the app or even apk before installing it.
But we have Automagic. The easiest method is to go the trigger, choose trigger app task started/ended, choose the app and you got the packagename directly. Simply copy-paste it to the Execute root command.
Regardless using busybox or not, you can simply pipe the command to the grep, so it only output the lines you grep. For example we want to check if the mixplorer is running, MiXplorer is
com.mixplorer or
com.mixplorer.test if you use the testing version.
put condition debug dialog after the command to check the result. If mixplorer is running, you should see {stdout} has the result. If it is not, stdout will be empty or '' (two single quotes, nothing, but not null). Use expression
or
to check it. If true, app is not running. False, app is running. But it is a bit tricky though for some app that has service. Some might have the app running, but the service has different naming. You have to spot it then. You can find the different naming for the app at the condition service running.
For your case, Display Brightness Pro is rubberbigpepper.DisplayBrightnessPro (check with your version, I check it on xda version apk). The command become
Code: Select all
ps -A | grep rubberbigpepper.DisplayBrightnessPro