Volume control using Macrodroid


Question

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 ?


Answer

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 <conditions> 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



enter image description here



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 → 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 with Macrodroid :)


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes