Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let me explain the scenario:

I always keep my phone in vibration mode (no ringer, no notification sounds, just the vibration), since I'm a forgetful person and I'd end up forgetting to turn the ringer off when I'm in a meeting or other occasions when it wouldn't be appropriate.

This works fine for my needs, except in one instance: when listening to music. When I listen to music I typically keep my phone in the pocket of my jacket and I end up missing all my notifications, since between the music and the fact I don't have the phone in my hand or on my desk I can't hear nor feel the vibration.

My question is: is there a way to turn the ringer/notification sound on when the headphones are connected, while keeping it off when they aren't?

I'm running rooted stock Marshmallow (6.0.1)

share|improve this question
2  
Just for the sake of completeness, what is your phone model? Nexus phones (or probably, AOSP ROM and some other phones) have separate volume settings when on normal mode/headphone plugged. – Andrew T. Jan 16 at 13:46
    
@AndrewT. I'm on a Nexus 4 (AOSP). But the separate settings you mentioned only apply to media volume and (maybe) bluetooth. I tested it and the ringer/notification volume stays the same, with ot without headphones plugged. – Master_T Jan 16 at 15:08
    
Deleted my answer, as the SoundAbout app was actually doing something else (rerouting all audio to headphones) than what I thought it was doing (unmuting on headphone insert). – Piskvor Jan 19 at 8:39
up vote 4 down vote accepted

I don't have Android Marshmallow but following apps can easily achieve the goal on Android Lollipop 5.1. Should not fail on your OS, I believe. Let me know the result in any case.

MacroDroid

When headphones are plugged:

  • Trigger: Headphones Insert/Remove → Headphones Inserted
  • Action: Volume Change → select Notification and Ringer, and configure the slider for the level of volume you want

When headphones are removed:

  • Trigger: Headphones Insert/Remove → Headphones Removed
  • Action: Volume Change → select Notification and Ringer, and keep the slider to 0

Automate

It seems to work too. Your flow should look like this:

(Click image to enlarge)

IMG:

Relevant blocks:

  • Interface → Wired headset plugged?
  • Settings → Ringer mode set

The said flow would cause the ringer and notification volume to come back to the level you set them to, before switching the phone to vibration.

Atooma

It worked as well. However, it appears to not been updated since May 2015.

When headphones are connected:

  • IF: Headphone → Plugged
  • DO: Audio Manager → Set ringer volume → configure the slider
  • DO: Audio Manager → Notification volume → configure the slider

When headphones are removed:

  • IF: Headphone → Unplugged
  • DO: Silent mode → On → Vibrate: Yes

Droid Automation

It also worked well for me.

Instructions:

  1. Profile: Headset plugged

    1. Trigger: Headset state → Becomes plugged
    2. Task: Sounds & Media → Volume: Ringtones → configure
    3. Task: Sounds & Media → Volume: Notifications → configure
  2. Profile: Headset unplugged

    1. Trigger: Headset state → Becomes unplugged
    2. Task: Sounds & Media → Volume: Ringtones → configure to zero
share|improve this answer
    
Ah, yes, doze mode. Thanks to LJD200 for mentioning it in their answer. In case MacroDroid fails because of Doze mode, try this answer as a remedy: Is there a way to exclude an app from Doze? – Firelord Jan 16 at 12:05
1  
Other settings may affect if not implemented, not just doze. Suggesting OP to have a look at this answer for all settings and a quick start guide to MacroDroid, if you don't mind android.stackexchange.com/a/133394/131553 – beeshyams Jan 16 at 13:19
1  
The only settings/issues that are relevant here from your answer are about task killers and the running Android's special battery optimization techniques. Accessibility and notification access settings has nothing to do with the triggers I proposed. But thanks. I would recommend OP to specifically look for the heading System Settings in your linked answer, if not concerned with quick guide since app already offers that. :) – Firelord Jan 16 at 14:13
    
Used MacroDroid, seems to work well. As for doze: doesn't plugging/unplugging the headphones actually generate an event that wakes up the device anyway? (not sure about this, just asking) – Master_T Jan 16 at 15:04
    
@Master_T, sorry, I can't really comment on how doze handles these things. A simple logic follows that plugging headset results in a broadcast android.intent.action.HEADSET_PLUG being issued. MacroDroid would've registered a receiver for that broadcast so that it can be notified immediately and the actions get executed per user's configuration. What I don't know is whether Android, when doze is active, allows apps to be activated for such inconsequential broadcast. – Firelord Jan 16 at 15:11

Ensure Tasker is installed and enabled. I tested this with Tasker 4.8 on Android 6.0.1 Marshmallow. If you are using Tasker on Marshmallow, it will work more effectively if you disable battery optimisation under the Android Settings (although this may also drain the battery quicker). To do this, navigate to Battery -> Triple dot menu (in the upper-right hand corner) -> Battery optimisation. Then click on the drop-down menu and select All apps and scroll down to Tasker. Click on Tasker and press Don't optimise followed by Done.

To do this, open Tasker and create a new task. Name it whatever you like. Then add an action and navigate to Audio -> Ringer Volume. Drag the slider to 7 (this is the maximum volume and you can adjust this if you want). Do the same for Audio -> Notifcation Volume under the same task.

Now add a profile and navigate to State -> Hardware -> Headset Plugged. Don't change the default options here and navigate back. You will now be prompted to add a task. Select the task that you created earlier.

Once ensuring that the profile is enabled, exit Tasker and set your notifcation/ringer volume to vibrate.

That's it. The ringer and notification volumes should now change automatically when you plug and unplug your headphones.

share|improve this answer
    
@Firelord Thanks, I've edited the post. – LJD200 Jan 16 at 12:03
    
Yes, now it can be followed. Good work. :) – Firelord Jan 16 at 12:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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