[updated: March 29th, 2015 | Aman Surana created a great youtube video on how to do this. The main difference is that he is using a plugin (comes as an app which extends Tasker) called AutoNotification. The biggest benefit is that it abstracts the application notification layer into a standard set of variables. This allows you to utilize apps other than the main SMS app (ex: now you can use things like WhatsApp, Google Hangouts, etc). It also works with the latest version of Android, which I am starting to get the feeling that my profiles bellow do NOT work with anymore. Anyway, you can find the video here: https://www.youtube.com/watch?t=37&v=c-Kp9KynlV4, and read the post here since the idea behind how to do this still holds. That and it’s an interesting way to accomplish this task – no pun ;)]

I walk outside listening to Pandora quite a lot, and today I realized that I miss about half the SMS’ that I get. Either because it’s too noisy, or maybe because the SMS’ are not loud enough and I use a single beep, or because the sound trigger gets interrupted by Pandora, but either way, it’s a bit annoying. I have been considering some sort of a solution that will play incoming SMS messages when my headphones are plugged in for quite some time, but I couldn’t think of an efficient way to do it — that is, efficient on the battery. I think I came up with one today.

The idea behind this Tasker program is the following:

There are two Profiles: ‘Detect Headphones‘ and ‘Play Text Over Headphones‘. Only one Profile has to be actually active at all times – the Detect Headphones one. When you plug in your headset (with microphone, or just regular headphones), the profile sets a variable %HEADPHONES to ‘yes’. It then turns on the second Profile – the one that monitors incoming SMS messages and plays them over the headset if your %HEADPHONES variable is set to ‘yes’.

The interesting discovery I made was about pausing/muting Pandora. My solution was to set the Media volume to 0, and to set the In-Call volume to 4 (since 5 is too loud over headphones), then play the SMS using the In-Call audio channel, and then set the Media volume to 9 (roughly ‘normal’) and the In-Call volume to 5 (max). When you unplug your headphones, the Detect Headphones profile clears the variable, and de-activates the Play Text Over Headphones profile. I truly don’t think there is a more efficient way to write this, both in terms of simplicity and in terms of battery usage — which is currently <1-2% throughout the day.

So, to recap, the only side effect after you are done with all of this is that your Media volume will be set to 9, and your In-Call volume will be set to 5. Both of these can be customized to values that you find appropriate. Also, instead of setting each individually, you may just re-call one of my sound-profile tasks (like ‘Work’, or ‘Normal’, or ‘Sleep’)

Here are the Profiles:

Headphones.zip [updated: 02-22-2012]
(md5: abd66180b4f5c75125ef48e9c5e95f80)

BUGS: There aren’t any really, but I’ve noticed that If you receive multiple SMS’ quickly (ex: someone sending “1”, “2”, “3” within a second or two, it will only pick up the first – this is a limitation on the Android notification detection framework. Also, I am sure that even if that wasn’t a limitation, the sound synthesizer would not be able to keep up.

Hope you enjoy, and as always, leave comments – both about things that work and things that don’t.

11 Thoughts on “Speak SMS over the Head Phones only when they are plugged in

  1. Hi there!

    I downloaded the zip file and I could barely understand it. It gave me a bunch of numbers. Is there anyway you could email me the breadcrumb trail(step by step) guide on how to do this please?

    This is greatly appreciated :)

    Thanks my friend!
    -Sparco

  2. Hey – if you haven’t used tasker, check out these two posts:

    1.) http://blog.vpetkov.net/2011/05/10/androids-best-app-tasker-visual-programming-and-automation/
    This will tell you about the major components

    and

    2.) http://blog.vpetkov.net/2011/05/10/my-tasker-program-blackberry-sound-profiles-for-android/
    This should tell you how to import things. See especially steps 2-4. With new versions of Tasker things have changed a bit menu-wise, but you should be able to figure it out.

    When you install tasker, the basic idea is that you will create the profiles by dropping them into the right folders on your SD Card – you will need to create the folders if this is the first time. After that, you can import them, enable them, and the rest should happen automatically.

  3. Here are some steps that should better explain this:

    1.) First – You need to have Tasker :)
    2.) You need the correct folders on your SD card. From this URL (http://tasker.dinglisch.net/userguide/en/faqs/faq-how.html#q), it sounds like the new version of Tasker might be able to create them for you just by importing, so:
    You just need to download the zip, extract it, go into Tasker and do an import of both profiles.
    3.) Enable the “Detect_Headphones” profile.
    4.) The idea is that that profile will monitor for the physical plugging in and out of your headphones. When they are plugged in, it will enable for you the “Play_Text_Over_Headphones” which does everything. When you remove your headphones, it will disable the “Play_Text_Over_Headphones” profile, and monitor for your headphones again.

  4. Hey Ventz!

    I am both shocked and incredibly impressed with how quick you responded 😀

    Apparently I am not new to tasker,in fact I’ve created 8 working profiles already. Although, I admit that I am fairly new to importing profiles.

    Thanks a bunch! I shall read up on it shortly and see if I could make it work.

    Keep up the good work!

    -Sparco

  5. Hiya Ventz!

    I’ve read the post and followed the instructions. Sadly, my tasker wont recognize the files I unzipped. At your convenience, please please please send me the step by step guide instead :'(

  6. Hey,
    I dont know if you’re still here or not, i followed and imported the profiles, but it doesn’t seem to work.
    My notification bar says no active profiles, even though the first one is active.

  7. Hey Aman,

    Quite a bit of time (~3 years) has passed, and it’s possible that something has changed in Tasker. This should not be too hard to debug though. Let’s start with first just enabling the “Play Text Over Headphones” profile. Then create a variable (manually) called “%HEADPHONES” and set a value of ‘yes’.

    What happens when you send a MSG to yourself (or even hit the ‘play’ button for the profile in order to run the profile and test it). If you open it in Tasker, do you hear it speak out your last SMS MSG? (double check the volume in case it’s not setting it).

    Another thing that I can think of — it’s possible that the variable names for the “MSG PARTS” changed. Make sure they are still:
    From: %SMSRN %SMSRF Message: %SMSRB

  8. Doesnt seem to work, nothing happens when i send myself a message, when i hit the play button, nothing again,checked everything.

    i guess i’ll figure something out, or create something new.
    Thanks tho

  9. Ventz on March 25, 2015 at 1:28 am said:

    It might just be due to all the changes in Tasker. It should be very easy to re-create this from scratch.

    Start with just the part that plays out the parts from an SMS. Add the “headphone trigger” later. The idea behind the trigger is that it simply does: headphone detection and other than setting a variable, it enables the “play profile”.

    If I can get my hands on an Android phone, I can test it out/create a new one.

  10. Well i figured something out ventz!

    https://youtu.be/c-Kp9KynlV4

    What do you think? (Yeah i made this),
    If you think it’s nice do you mind featuring it on your blog?
    Thanks!

  11. Ventz on March 29, 2015 at 8:51 am said:

    Interesting way of doing it with AutoNotification. The nice part in using that is that it intercepts all “events” for you.

    Anyway, very nice. I’ll do you one better — I’ll post it on the blog itself. (see “updated” section on top of blog)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Post Navigation