Archive

Archive for February, 2012

Speak SMS over the Head Phones only when they are plugged in

February 20th, 2012 No comments

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.

Timed Blackberry Sound Profiles for Android

February 1st, 2012 10 comments

The general idea behind this is that it utilizes my original Blackberry Sound Profiles for Android and it adds a “timer” element which can be set. Upon setting the timer, it will set a temporary task until the timer runs out. The idea came from one of my visitors who asked me how to do this. At first, I had no idea how to do it. About 30 minutes later I had a semi-working prototype. Another 3 hours later (had to figure out how Scenes worked and interacted with variables and the rest of the system) I had the final version with a working GUI.

The first thing that you need are my Tasker Blackberry Sound Profiles found here: (http://blog.vpetkov.net/2011/05/10/my-tasker-program-blackberry-sound-profiles-for-android). If you don’t have them yet, follow the super quick “Getting Started” section. Once you have the tasks and you have them working (if you want this to work out of the box, grab at least the “Work” task and the “Sleep” task), download the Timed extension:

Note: You need the current BETA to import this profile: http://tasker.dinglisch.net/beta.html (1.2.1b4m)

Timed.zip
(md5: 5709a9ed0b139a027900d9f8f1e2e92a)

Now unzip it and follow the same steps from the original post – grab the “Timed.tsk.xml” file and import it into the the Tasks tab, and then grab the “TimedScene.scn.xml” file and import it into the Scenes tab. Go to your home screen and create a Tasker widget of your “Timed” task. Every time you select this task, it will pop a box which will let you use a slider or directly type in a number. After this, when you hit “Set Profile”, the temporary task (by default “Sleep”) will get activated for the number of minutes you set. After that time period it will go back to the other (by default “Work”) task.

 

USAGE:

1.) Make sure that you have at least my “Work” and “Sleep” sound-profile tasks. If you don’t, at least have any 2 sound-profiles, and edit the “Tap” action for the “Set Profile” button to have the two tasks.

2.) Create a widget on your home screen from the “Timed” task. Then launch the GUI from it, and set a minute count using the input box (top right), the slider, or the plus and minus keys. HINT: if you hit and hold the plus/minus buttons, they increase and decrease the minute count by 10. Use one or all. Whatever works the best

3.) Click “Set Profile”. What this will do is create a permanent notification with the time you started and for how long, and then set the “Sleep” profile (or whatever you chose instead) for the given time period. When the time expires, it will revert to the “Work” profile (or whatever you chose instead). If you want to cancel it early, select the “Timed” task widget from the home screen, and click “Cancel Profile”.

 

TECHNICAL DETAILS:

1.) The “Timed” task simply acts as a launcher. I use it so that I can launch my Timed Scene as a Dialog box. Being a task, you can also create a widget out of it for the home screen. This acts as the entry point to the program/GUI. I also use it to set some defaults – specifically: the default minute count in the %TMINUTE variable, and then I reflect the variable in the input box and the slider.

2.) The Timed Scene is the work horse here. One way you can set things is by entering a value in the input box at the top right. As soon as you do that, the %TMINUTE variable is set and the slider is changed accordingly. The second way to set things is via the Plus and Minus buttons. If you tap them, they will increase and decrease the %TMINUTE variable by 1. If you tap and hold them, they will increase and decrease the variable by 10. Taping them will also change the slider and set the count in the input box accordingly. The third way is to slide the slider. This will once again set the %TMINUTE variable, and it will change the input box to reflect accordingly. The “Set Profile” button destroys the GUI, sets a permanent notify with the start time and the number of minutes you have selected,  and it performs the task. It then waits the number of minutes that you have chosen and it basically undoes everything when the timer goes off. The “Cancel Profile” button destroys the GUI, expires the timer and removes the permanent notification. This in turn activates the “undo” section in the “Set Profile” section, which sets the “Work” profile and removes the permanent notification.

 

“Set Profile” button action in the Timed Scene is the work horse. It holds all the glue and magic to make this work. The main idea here is to pull the current time in seconds, add the value of seconds you want to wait (the input of minutes multiplied by 60) into a variable called %TALERT, and then poll every minute for the condition of the current time being greater than the value of %TALERT. Simple and beautiful huh? A few other things are having the sticky Notify and then removing it, and performing the Tasks obviously.

Good luck, and as always, feel free to ask questions. I’ll try my best to help out.