Android and Linux

Friday, September 10, 2010

Tasker car profile

At the risk of turning this into a Tasker blog, I thought I would share my new use. Now that I have a sweet car dock, I needed to set up Tasker to do a few things when I docked and undocked the phone.

When I enter the Jeep, I wanted the screen to go to full brightness, GPS to turn on and WIFI to turn off. When I exit, I want to mark my location with GPS, dim the screen to normal, turn GPS off, turn wifi back to the state it was in when I entered, and play a sound to remind me to grab the phone. I also don't want this to always happen when I plug the phone in, so I needed an option to turn it off easily.

I didn't read any other car dock profiles online and did this on my own, so I probably did it entirely the wrong way, but here goes. I did it all in several separate steps.

The first is a Task called "JeepOn" with the following steps.

1 Variable Clear %WIFISTATE
2 Variable Clear %GPSSTATE
3 Variable Set %WIFISTATE to 1 if %WIFI matches "on"
4 Variable Set %GPSSTATE to 1 if %GPS matches "on"
5 Display Brightness 255
6 Wifi Off
7 GPS On
8 Flash "Jeep Mode"

That's pretty simple. It records whether the GPS and WIFI are on, turns GPS on, WIFI off, and brightens the screen.

The second is called "JeepOff"
1 Variable Set %BEACON to %LOC
2 GPS off
3 WIFI On if %WIFISTATE equals 1
4 Flash "Jeep Mode Off.
Wifi: %WIFI
GPS: %GPS
Beacon set with %LOA m accuracy."
5 Notify Sound. [pick a sound file] Title "Jeep Mode Off"
6 Wait 5 seconds
7 Notify Cancel
8 Display Brightness 40

Here's an explanation of what this does.
1- This records my GPS position into a variable called %BEACON. I have a widget set up that simply opens Maps and take me back to that spot. This is done by selecting "Navigate To" mode "and putting %BEACON in the lat/long field.
2- Turns off GPS
3- Sets WIFI to the state it was in before. I'm not sure how useful this will be, but I have wifi set to turn on and off at certain times of the day so this should help it stick to that schedule.
4- Tells me the WIFI/GPS state and how accurate the beacon was set
5-7 - Plays a sound to remind me not to forget the phone. Since the only way to play a sound is by using a statusbar notification, which I don't really want, the next two steps are for clearing the notification without having to open the notification bar.
8 - dims the screen to the level I usually keep it on.

I'm not sure if my car charger shows up as AC or USB, but I use both at home and don't want all this to happen every time I plug the phone in, so I wanted to be able to disable Jeep Mode. I did this in two steps. The first is a new profile for "Power - source - any" called "JeepMode" with the action "Perform Task - JeepOn" and the exit action "Perform Task - JeepOff". Then I added a new Tasker widget to the homescreen and added the action Profile Status - JeepMode - Toggle. Tapping the widget turns it on if it was off, and vice versa.

So, if I'm sitting around the house I can leave JeepMode turned off and plug in the phone at will. If I'm going to drive to work and don't need JeepMode, I can plug in without it, but if I'm doing a lot of driving and getting in and out of the vehicle and think I'll need it all day long, I tap the toggle and it stays on until I tap it again.

Followers