Volume control using Macrodroid My friend has the same problem on his Samsung device as described here Android automatically corrects my volume

I showed him the solution and it worked beautifully for him. But he would like to make it work whether Google Play Music is in foreground or background, which beeshyams in his answer said is possible but perhaps didn't add as OP didn't  ask for that.

I have Macrodroid installed ( learner ) and tried to modify that macro by the condition While Google Play Music in foreground OR ( ) Background and it didn't work

What am I doing wrong and how to achieve the Macro perform as required ?
Macrodroid has three powerful conditional statements


WHILE / DO , which you tried is not suitable. It doesn't work with OR ( background or foreground ) . That leaves us with
IF &lt;conditions&gt; ELSE which is also not appropriate . Reason you have 4 states , app in Foreground, Not in foreground , Alive in background , Not running - if you choose one state with IF ,  ELSE would cover all 3 remaining states and that's not what you want
That leaves us with two IF loops , each having the corresponding WHILE loop nested. Two WHILE loops in similar fashion may work but I didn't try ( stuck me just now )


Macro would look like this ( didn't add in linked answer so as to keep it simple and I had the macro ready ). Trigger and constraints would remain same. Only actions shown



You may need a second macro ( for user convenience,  and to ensure that macro is not active in other two states) to disable this macro. It would have empty trigger and single action of Macro Stop &rarr; Lossless Music 2. Go to the widgets section of your launcher , drag and drop Macrodroid widget to your home screen and assign it to the macro just created with empty trigger. 

If Google Play Music is inactive as an example , but you are listening to music on another player, you certainly wouldn't want that player to be locked down. Or let's say you like listening to Heavy Metal on Play music with volume at 75% , you wouldn't want the same volume to persist. As additional precaution

I tested this for the other answer , so you are good to go with this

Happy automation with Macrodroid :)