• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Anyone using Tasker?

How can I setup tasker so that auto-rotate is disabled when the messaging app is opened?
 
Tasker has a limit of 3 contexts for a profile, so what you're looking for can't be done as it normally would be.

First, a profile that will combine two contexts into one, using a variable:

Profile: Work Hours
Context: Day [Mon Tue Wed Thu Fri]
Context: Time [From 08:00] [To: 17:00]
Enter Task:
Variable Set [Name: %WORKHOURS] [Value: 1]
Exit Task:
Variable Clear [Name: %WORKHOURS]


Second, a profile to make sure GPS is on when you're powered. If GPS was off before you plugged in, it will be turned off when you unplug. You may want to purposely turn it off in an exit task to make sure that it doesn't end up draining your battery.

Profile: Power On
Context: Power [Source: Any]
Enter Task:
GPS [Set: On]


Now, the profile that actually sends the message.

Profile: I'm Out
Context: Variable Value [Name: %WORKHOURS] [Value: 1]
Context: Power [Source: Any] [Invert: Checked]
Location: Office [Network: On] [GPS: On]
Exit Task:
Stop If %WORKHOURS Isn't Set
<whatever actions you have working right now go here>

At first, the inverted power source context and use of an exit task instead of an enter task look wrong, but here's why it's right...

With a non-inverted power source context and an enter task, when you plug in your phone in the car, while still within the Office location, Tasker will activate the profile and send the message. This is what you want. But it will also activate the profile and send the message when you return to work with your phone plugged in, because as soon as you arrive at work, all of the contexts will become true.

As shown above, the profile will be active when you're at work and not plugged in. As soon as you plug in at work, the profile will become inactive, causing Tasker to send the message. But, when you're already plugged in and return to work, Tasker won't do anything. Then when you unplug at work, Tasker will activate the profile and the cycle starts all over again.

Additionally, once normal work hours have ended, the %WORKHOURS variable will be cleared, causing the "I'm Out" profile to exit. To account for this, the task will stop (and not send the message) if the %WORKHOURS variable isn't set.

This probably needs some tweaking, as I haven't tested any of it.

First of all, I really, really appreciate the help. I didn't realize you could use Tasker to define variables like that, but that is going to be extremely useful to me.

Second of all, I'm not sure that the inverted will get me the behavior I want. I think I may have failed to explain what I want properly. This is what I want to happen:

1. I walk out the door at work and get into my car.
2. I plug my phone into my car dock. Tasker is currently set up to turn on BlueTooth when I do this as well as make the screen brighter and activate my mileage tracking app. This works beautifully.
3. GPS turns on and Tasker checks my GPS location.
4. The script sending the email is executed.

I only want this to happen when I'm leaving the office. I don't want an e-mail generated when I arrive at the client site. I don't want an email generated when I leave the client site. I don't want an email generated when I get back to the office. I may want an email generated when I leave the client site down the road, but for now I don't want that.

Edit again: I've played with it some and this is what I've set up (I'm using some shorthand, but I think you can get the idea):

Profile 1 - Set work hours
Context - M-F, 0800-1700
Task - Set Variable %WORKHOURS = 1
Exit task - Clear Variable %WORKHOURS%

Profile 2 - Send e-mail
Context - %WORKHOURS = 1
Context - Power State = Car Adapter
Context - GPS Location = Work
Task - Execute Send e-mail script

My worry with this set up is that the email will be sent when I leave the office (all three context states will be true) and will happen again when I return (again, all three contexts will be true). Can I change one of the contexts to something like Context - Power State changes to = Car Adapter. This way it would be triggered when I left the office (power state would change from battery to car adapter), but wouldn't be triggered when I got back to the office (no change in power state originally and then power state changes from car adapter to battery).
 
First of all, I really, really appreciate the help. I didn't realize you could use Tasker to define variables like that, but that is going to be extremely useful to me.

Second of all, I'm not sure that the inverted will get me the behavior I want. I think I may have failed to explain what I want properly. This is what I want to happen:

1. I walk out the door at work and get into my car.
2. I plug my phone into my car dock. Tasker is currently set up to turn on BlueTooth when I do this as well as make the screen brighter and activate my mileage tracking app. This works beautifully.
3. GPS turns on and Tasker checks my GPS location.
4. The script sending the email is executed.

I only want this to happen when I'm leaving the office. I don't want an e-mail generated when I arrive at the client site. I don't want an email generated when I leave the client site. I don't want an email generated when I get back to the office. I may want an email generated when I leave the client site down the road, but for now I don't want that.

Edit again: I've played with it some and this is what I've set up (I'm using some shorthand, but I think you can get the idea):

Profile 1 - Set work hours
Context - M-F, 0800-1700
Task - Set Variable %WORKHOURS = 1
Exit task - Clear Variable %WORKHOURS%

Profile 2 - Send e-mail
Context - %WORKHOURS = 1
Context - Power State = Car Adapter
Context - GPS Location = Work
Task - Execute Send e-mail script

My worry with this set up is that the email will be sent when I leave the office (all three context states will be true) and will happen again when I return (again, all three contexts will be true). Can I change one of the contexts to something like Context - Power State changes to = Car Adapter.


Instead of making it automatic, why not make a widget or 2. Have a widget so all you do is press it and it notifies the secretaries that you are leaving for the day. Then make another for when you leave the clients site. Maybe add GPS fix function so it will include a Google Maps shortcut to your location.
 
Instead of making it automatic, why not make a widget or 2. Have a widget so all you do is press it and it notifies the secretaries that you are leaving for the day. Then make another for when you leave the clients site. Maybe add GPS fix function so it will include a Google Maps shortcut to your location.

That's not a bad idea. I'll take it under advisement for sure. I'm going to have to think about that. My other idea I have is to have something like this:

Variable called %POWERCT.
While power state = car charger, add 1 to %POWERCT every 5 mins (or 2 mins or whatever). I'd add an exit task to reset the variable so when I unplugged my phone, the variable would go back to 0.

So basically as long as the phone is plugged into the charger, the counter goes up. I would then set my send email task like this:

Context - %WORKHOURS = 1
Context - %POWERCT = 1
Context - GPS loc = Work
Task - Execute email script

Basically I would plug my phone in during work hours and it would immediately add 1 to the %POWERCT. This would trigger my task and send the email. When I plug in my phone while leaving a client site, it would also add 1 to the %POWERCT variable which would cause Tasker to fire up GPS and check my location. This would be no big deal as I'd be plugged into my car adapter so sucking juice periodically would be no problem. The second %POWERCT jumped to 2, it would stop checking. As long as I get back to the office in more than the 5 min (or however long) interval it takes for %POWERCT to jump up, then the script would not execute when I pulled into the parking lot. Does this logic make any sense at all or does it sound hair brained? I've looked at this problem so much I'm not sure I can see it rationally now.

I want this to be as completely automatic as I can make it. If I have to do something I may forget it if I'm in a hurry.
 
How the heck does one automate sending an email with Tasker??? I can only find Compose email.
 
It looks like that script would be fine for static email content. But, I want to call up my location via GPS through Google maps and have that inserted as a hyperlink into the email body.


PS thanks for tipping me off to the script.
 
Tasker is the best app I've come across. So far my uses for

Turn on WiFi when I'm at home, and off again when I leave.

Could I get a little help with doing this? I have tried but don't seem to be making any progress.

Also its there a way to make the phone check the gps less frequently or use only the cell network to determine location only?

Thanks in advance
 
...Second of all, I'm not sure that the inverted will get me the behavior I want. I think I may have failed to explain what I want properly. This is what I want to happen:

1. I walk out the door at work and get into my car.
2. I plug my phone into my car dock. Tasker is currently set up to turn on BlueTooth when I do this as well as make the screen brighter and activate my mileage tracking app. This works beautifully.
3. GPS turns on and Tasker checks my GPS location.
4. The script sending the email is executed.

I only want this to happen when I'm leaving the office. I don't want an e-mail generated when I arrive at the client site. I don't want an email generated when I leave the client site. I don't want an email generated when I get back to the office. I may want an email generated when I leave the client site down the road, but for now I don't want that.

Edit again: I've played with it some and this is what I've set up (I'm using some shorthand, but I think you can get the idea):

Profile 1 - Set work hours
Context - M-F, 0800-1700
Task - Set Variable %WORKHOURS = 1
Exit task - Clear Variable %WORKHOURS%

Profile 2 - Send e-mail
Context - %WORKHOURS = 1
Context - Power State = Car Adapter
Context - GPS Location = Work
Task - Execute Send e-mail script

My worry with this set up is that the email will be sent when I leave the office (all three context states will be true) and will happen again when I return (again, all three contexts will be true). Can I change one of the contexts to something like Context - Power State changes to = Car Adapter. This way it would be triggered when I left the office (power state would change from battery to car adapter), but wouldn't be triggered when I got back to the office (no change in power state originally and then power state changes from car adapter to battery).

Avoiding sending the email when you arrive at the office during office hours with the phone plugged in is something I was trying to avoid.

Tasker is aware of two power states: AC and USB. Your charger will be identified as one of these, but which one will depend on the charger. You can't specifically identify a car adapter.

Using a "positive" non-event context (not inverted) only requires that you be in that "state" for the context to become active. So if you're using the following:

Context: %WORKHOURS = 1
Context: Power Any
Context: Location Work
Enter Task: send email

and you are already at work during work hours, when you power your phone the email will be sent, because the moment you power your phone, all three contexts are satisfied and the profile becomes active. Once you leave the work location, the profile exits. Then when you arrive at work again with your phone powered during work hours, the profile activates and the email is sent again.

By using:

Context: %WORKHOURS = 1
Context: Not Power Any
Context: Location Work
Exit Task: send email if %WORKHOURS isn't set

and you are already at work during work hours, when you power your phone the profile will exit and the email will be sent because the power context is no longer satisfied. The profile can only exit (and send the email) after is has become active again. So to send the email again, you'll have to return to work during work hours, unplug your phone (activating the profile) and then plug in your phone (exiting the profile).

One way to look at it is to consider that the secretaries assume you are in the office unless they are told otherwise. So, "in the office" is the normal condition, and this can be identified by location context and the %WORKHOURS variable. We're using the power context to get Tasker to react immediately, rather than wait for the normal location check frequency.

A couple more things that may help clarify this, but you'll need to bear with me a little bit...

Event contexts don't have an exit task, and don't restore settings. Examples include Phone Offhook and Phone Idle. Let's say you want to change the display timeout while you're on the phone, but you also want to change it back again (to whatever it was, without knowing what it was) when you hang up. You couldn't do this with event contexts because their profiles don't restore settings. You can work around this problem with the following profiles:

Context: Phone Offhook
Task: Variable Set %OFFHOOK = 1

Context: Phone Idle
Task: Variable Clear %OFFHOOK

Context: Variable Value %OFFHOOK = 1
Enter Task: Display Timeout 5 minutes

I essence, you're tricking Tasker into treating a combination of two events (Phone Offhook and Phone Idle) as a state.

For your profile, we need to do the opposite - trick Tasker into treating a state like an event. We don't want to do something while your phone is plugged in, we want to do something at the moment your phone is plugged in. We can do this by using an inverted state combined with an exit task. In this case, in order for the exit task to run, the phone must transition from a state of being unplugged to a state of being plugged in.

I know it sounds weird, but it does work.
 
Could I get a little help with doing this? I have tried but don't seem to be making any progress.

Also its there a way to make the phone check the gps less frequently or use only the cell network to determine location only?

Thanks in advance

Try New > State > Wifi Near
Enter SSID
Enable Toggle Wifi

Task:
New (Name)
Net > Wifi > Set - On
Done
 
Avoiding sending the email when you arrive at the office during office hours with the phone plugged in is something I was trying to avoid.

Tasker is aware of two power states: AC and USB. Your charger will be identified as one of these, but which one will depend on the charger. You can't specifically identify a car adapter.

You're right. My car adapter is recognized as AC by the phone and that's what I've been using. When I'm at home or work, I've got the phone plugged into my computer which is USB of course. I'm using the AC event as a car charger.

Using a "positive" non-event context (not inverted) only requires that you be in that "state" for the context to become active. So if you're using the following:

Context: %WORKHOURS = 1
Context: Power Any
Context: Location Work
Enter Task: send email

and you are already at work during work hours, when you power your phone the email will be sent, because the moment you power your phone, all three contexts are satisfied and the profile becomes active. Once you leave the work location, the profile exits. Then when you arrive at work again with your phone powered during work hours, the profile activates and the email is sent again.

By using:

Context: %WORKHOURS = 1
Context: Not Power Any
Context: Location Work
Exit Task: send email if %WORKHOURS isn't set

and you are already at work during work hours, when you power your phone the profile will exit and the email will be sent because the power context is no longer satisfied. The profile can only exit (and send the email) after is has become active again. So to send the email again, you'll have to return to work during work hours, unplug your phone (activating the profile) and then plug in your phone (exiting the profile).

Wouldn't those conditions exist when I'm just sitting at my desk though if I don't have my phone plugged in? It would be during work hours, the phone would be on battery power and my location would be work.

One way to look at it is to consider that the secretaries assume you are in the office unless they are told otherwise. So, "in the office" is the normal condition, and this can be identified by location context and the %WORKHOURS variable. We're using the power context to get Tasker to react immediately, rather than wait for the normal location check frequency.

A couple more things that may help clarify this, but you'll need to bear with me a little bit...

I will take as much explanation as you can give me.

Event contexts don't have an exit task, and don't restore settings. Examples include Phone Offhook and Phone Idle. Let's say you want to change the display timeout while you're on the phone, but you also want to change it back again (to whatever it was, without knowing what it was) when you hang up. You couldn't do this with event contexts because their profiles don't restore settings. You can work around this problem with the following profiles:

Context: Phone Offhook
Task: Variable Set %OFFHOOK = 1

Context: Phone Idle
Task: Variable Clear %OFFHOOK

Context: Variable Value %OFFHOOK = 1
Enter Task: Display Timeout 5 minutes

I essence, you're tricking Tasker into treating a combination of two events (Phone Offhook and Phone Idle) as a state.

Ok. I follow you so far.

For your profile, we need to do the opposite - trick Tasker into treating a state like an event. We don't want to do something while your phone is plugged in, we want to do something at the moment your phone is plugged in. We can do this by using an inverted state combined with an exit task. In this case, in order for the exit task to run, the phone must transition from a state of being unplugged to a state of being plugged in.

I know it sounds weird, but it does work.

I'm still not convinced it will work, but I'm willing to try it out the way you've suggested. I'll set it up initially to only send an email to me. That way if it's not working, nothing has been lost.

Let me make sure I'm following the logic though. In your explanation for the task to execute, three things must be true:

1. It must be during work hours.
2. The phone must be unplugged from AC power (car charger)
3. I must be at the office.

I don't follow how that works. Let's say I leave for a client site at 10 am on Tuesday. I plug my phone into my car charger and leave. #1 is true because it's during work hours. #3 is true because I'm at the office. #2 is not true because my phone is on AC power. So the task wouldn't execute? I'm confused.
 
Try this:

Context: Application [Phone]
Context: Button Camera [Stop Event: Checked]
Enter Task:
Mic Mute [Set: On]

I don't know if the camera button will actually respond during a phone call though.

Thanks, UncleMike. That's what I had thought (other than I didn't know to do 'Stop Event: Checked') but it doesn't work. I guess teh camera button won't respond during a call. I may try a gesture instead. Thanks for the hints though! Reading your responses have been very helpful!
 
@UncleMike - Since I'm still unsure of your logic, I've set it up two ways. My way with the While loop and your way with the inverted power logic. I've set up two scripts to generate two different emails. I have both of them emailing me right now. I'll see which emails I get under which conditions and see which, if either, actually work for me.
 
Tasker is an absolute gem. Only recently stumbled across it, so still on the learning curve! Have adopted most of the popular basic profiles mentioned here and on the wiki, but just thought of another one that makes another popular application much more effective: Wavesecure.

Always bugged me how this "security" app will NOT turn on GPS when you send the remote 'track' or 'lock' signal from a desktop pc! Seems daft that if you don't keep GPS on all the time (cos you never KNOW when you are going to loose your phone or get mugged) hitting the 'track' option is only give you cell tower triangulation location. Try asking the police to start searching a 1km radius for your phone!

Have set Tasker to turn on GPS when Wavesecure launches. I tested it. Turned off wifi and 3G on my phone (to eliminate any tracking that way) and went on my work PC and from the Wavesecure website, locked the phone and then tracked it. Got a Pin-Point accurate location! Even zoomed in on google maps and it got the right part of the building I was in! Unlocked my phone and was just in time to see the GPS icon disappear from my notification bar.

Hopefully by the time my Wavesecure subscription runs out (next March) I'll have figured out how to get Tasker to replace Wavesecure entirely. I.e. receive a SMS saying "showmylocation" and it turns on GPS, grabs a LAT/LONG value, and texts it back. Not sure it could handle the remote wipe function though!

Anyone already sussed this?
 
I'm having a problem with a Profile to shut off the Wifi when I turn the screen off and then turn it back on after.
I have two profiles with the contexts "Display Off" and "Display On".
Under "Display Off" I have three tasks.

Variable Set: WIFIONOFF to value %WIFI
Wait 30s (this is to stop it turning off when I accidentally hit the power button)
Wifi Set Off

Under "Display On" I just have one task:

Wifi Set On if WIFIONOFF = on.

This profile behaves perfectly when I turn off the display, but it also seems to be working when it shouldn't, namely when I run a full screen application. Is Display Off the correct context to be using?
 
Hi, I'm only a few hours into Tasker and love the tool. I've reviewed the forums and the docs but can't find an answer to what to me seems like a simple need. I would like to have an inverted location. The idea would be similar to an open feature request (ability to fix a location and then do something when moving out of range of it (see BuzzOff)).

Basically when I leave my house I would like to take action (turn on GPS, Bluetooth, etc.). I use multiple cars with and without bluetooth and I also go for walks. I already have a bluetooth profile in place and that seems to be working well. I would like to extend that to my wife's car where I don't connect with bluetooth and when I go for random walks.

Thanks in advance for your help.
 
I'm having a problem with a Profile to shut off the Wifi when I turn the screen off and then turn it back on after.
I have two profiles with the contexts "Display Off" and "Display On".
Under "Display Off" I have three tasks.

Variable Set: WIFIONOFF to value %WIFI
Wait 30s (this is to stop it turning off when I accidentally hit the power button)
Wifi Set Off

Under "Display On" I just have one task:

Wifi Set On if WIFIONOFF = on.

This profile behaves perfectly when I turn off the display, but it also seems to be working when it shouldn't, namely when I run a full screen application. Is Display Off the correct context to be using?

I'm curious what resolution you get as it sounds similar to a task I want. I want Tasker to turn off Bluetooth when I turn off my headset. This works fine at first. If the headset is already connected and I turn it off, BT on the phone turns off. However if I turn the headset back on and then then turn BT on, BT doesn't immediately connect to the headset so it turns back off. I tried something like this:

Context BT headset "My headset" = disconnected (inverted event)
Task : Wait 1 min.
Task : Turn off BT.

It didn't work. Turns off BT immediately.
 
Today at work, neither of the profiles I set up for the automatic email worked. I then discovered that my work hours profile was screwing up my work hours variable. By the time I fixed this, I was back in my office again so I don't know if either one of these profiles will ultimately work for me.
 
I'm having a problem with a Profile to shut off the Wifi when I turn the screen off and then turn it back on after.
I have two profiles with the contexts "Display Off" and "Display On".
Under "Display Off" I have three tasks.

Variable Set: WIFIONOFF to value %WIFI
Wait 30s (this is to stop it turning off when I accidentally hit the power button)
Wifi Set Off

Under "Display On" I just have one task:

Wifi Set On if WIFIONOFF = on.

This profile behaves perfectly when I turn off the display, but it also seems to be working when it shouldn't, namely when I run a full screen application. Is Display Off the correct context to be using?

Display Off sounds like what you want, but I'm curious about a couple of things:

  1. What do you mean by a full-screen app? Can you give an example?
  2. The default behavior for Android is for Wifi to sleep when the display is off, and use mobile data instead. Is yours not doing this, or is this insufficient for you?
 
Hi, I'm only a few hours into Tasker and love the tool. I've reviewed the forums and the docs but can't find an answer to what to me seems like a simple need. I would like to have an inverted location. The idea would be similar to an open feature request (ability to fix a location and then do something when moving out of range of it (see BuzzOff)).

Basically when I leave my house I would like to take action (turn on GPS, Bluetooth, etc.). I use multiple cars with and without bluetooth and I also go for walks. I already have a bluetooth profile in place and that seems to be working well. I would like to extend that to my wife's car where I don't connect with bluetooth and when I go for random walks.

Thanks in advance for your help.

You may want to look at using Wifi Near instead of Location (if you have Wifi at home), but all you need to do is create the profile with the enter and exit tasks reversed. The one down side to this is that you lose the ability to have Tasker automatically restore settings. For example, if you want GPS and bluetooth on when you're not at home:

Context: Location <home>
Enter Task: turn off GPS and bluetooth
Exit Task: turn on GPS and bluetooth

You may want to add other contexts to this to avoice prematurely turning off GPS and bluetooth as you approach home in your wife's car.
 
Today at work, neither of the profiles I set up for the automatic email worked. I then discovered that my work hours profile was screwing up my work hours variable. By the time I fixed this, I was back in my office again so I don't know if either one of these profiles will ultimately work for me.

There's always tomorrow...
 
I'm curious what resolution you get as it sounds similar to a task I want. I want Tasker to turn off Bluetooth when I turn off my headset. This works fine at first. If the headset is already connected and I turn it off, BT on the phone turns off. However if I turn the headset back on and then then turn BT on, BT doesn't immediately connect to the headset so it turns back off. I tried something like this:

Context BT headset "My headset" = disconnected (inverted event)
Task : Wait 1 min.
Task : Turn off BT.

It didn't work. Turns off BT immediately.

I don't know why it would turn off BT immediately, but there's another problem with that approach: any time BT is not connected (including when BT is off), this profile is active. Another issue is that once launched, tasks are independent of their profiles, so after 1 minute BT will still be turned off even if BT has connected in the meantime.

Here's another approach... don't invert the context, and move the enter task to an exit task:

Context: Bluetooth Connected
Exit Task: turn off BT

This way BT must connect first (to activate the context and profile) and subsequently disconnect (to deactivate the profile) before the exit task will turn BT off.
 
This seems like a basic question, but I have a car dock task set to crank up my ringer volume when in the docked state. I also have a task set up to turn my ringer off between certain hours monday-friday. So how do I set it up so that the car dock task overwrites the mon-fri task, and whenever I dock my phone during those hours, it will turn on the ringer anyway, and then when I exit the dock it goes back to the mon-fri task and turns the ringer off?

Additionally, I found the section to turn the ringer off under audio, but where do I find the option to change the phone to vibrate only? Ideally I would like to switch my phone to vibrate mon-fri during work hours rather than cut the ringer off. Thanks a lot.
 
Back
Top Bottom