0

I only ever unmute my phone when my headphones are plugged into it. I'm looking to automate this process. Here's what I want to happen:

if (headphones are unplugged) {

  mute all audio on the phone

} else {

  play audio through headphones

}

I've heard of automation apps like Tasker and Task, but I don't really know how to use them, or even if this is possible.

  • The system should automatically handle that for you. If you have your headphones unplugged and set the media volume to mute then plug them in, it should switch to (lets say) headphone mode. When you unplug them, it should switch back to mute for speakers. – CodeMonkey Mar 12 at 15:23
  • Unfortunately this isn't the case with Do Not Disturb mode. – reelyard Mar 12 at 21:27
  • What phone and version of Android are you using? – CodeMonkey Mar 12 at 22:53
2

I am using Macrodroid and Automate to demonstrate what you ask.

With Macrodroid

You will need to create 2 macros.

1st macro: Headset plugged

  • In the Trigger tab, select Headphones Insert/Remove, then choose Headphones Inserted followed by Any.

  • In the Actions tab, select Volume Change, then give the appropriate permissions. Set the level of each audio stream (see below picture on the left).

  • Give the macro a name, then save it. It will look like the picture on the right.

IMG: IMG:

2nd macro: Headset unplugged

  • In the Trigger tab, select Headphones Insert/Remove, then choose Headphones Removed.

  • In the Actions tab, select Volume Change, then give the appropriate permissions. Set the level of each audio stream to 0 (see below picture on the left).

  • Give the macro a name, then save it. It will look like the picture below on the right.

IMG: IMG:

With Automate

  • In the Interface section, select "Wire headset plugged?", then link its IN with the OK of the "Flow beginning" block.
  • In the Camera & Sound section, select "Audio stream mute state" twice.

    1. Click on the first block, set the state to Unmute, select an audio stream, then click Done. Link the IN to the Yes of the "When wire headset plugged" block, then Link the OK to the IN of the "When wire headset plugged" block.

    2. Click on the second block, set the state to Mute, then select an audio stream. Link the IN to the No of the "When wire headset plugged" block, then Link the OK to the IN of the "When wire headset plugged" block.

  • It will look like the image below. Give your flow a name then save it, then click on Start.

Note: I have selected Music stream for this example. Only the music will be muted/unmuted. Add more blocks for the other audio streams (voice call, alarm, system, etc).

IMG:

  • This is an excellent guide! Thank you very much for your input! I followed the Macrodroid steps and it's exactly what I wanted to achieve. – reelyard Mar 25 at 20:23
  • What an amazing walk through! Thank you for taking the time to do that. I dont even have a device that i believe can utilize this utility, but you lead me right along, and it was enjoyable even. Does macrodroid require root or any special permissions? – Evileclipse Mar 27 at 9:25
  • @Evileclipse Some features requires root but most don't. The most important is to give the appropriate permissions when required for the macros to work correctly. – Reddy Lutonadio Mar 27 at 12:24
  • @Evileclipse I was able to follow this guide using Macrodroid without needing to use any root access. – reelyard Mar 27 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.