1. Check out our app, Forums for Android! Download and leave feedback here!

Tasker if statements

Discussion in 'Android Apps & Games' started by lambed3, Aug 24, 2010.

  1. lambed3

    lambed3 New Member
    Thread Starter
    5

    Aug 23, 2010
    2
    0
    5
    I have been using tasker for a few days now in the trial period and I love it. It may be the best app I have used so far. I am getting a a point though where I am at my limit in terms of being able to get it to add additional conditions which primarily relate to if statements. I am hoping folks on this forum can help as I searched and did not see anything to guide me with my specific issues.

    Problem #1. When I leave home zone, I turn on GPS which I want to put a condition in that says wait 30 minutes and if Navigation is not on, turn GPS off so as to save battery. Most times I will enter the work zone in that timeframe which will turn it off anyway but on the odd chance I am taking a 2 hour road trip and not using GPS, I don't want to kill the battery.

    Problem #2. How can I use the profiles in the if statement? If not in home zone (circle on the map), do xyz or if not in home zone or work zone, do abc. Is this possible?

    Problem #3. Can I get tasker to run a widget from the phone, not an app but an actual widget related to an app?

    I have everything else working great but this fine tuning will make it work even better.

    Thanks.
     

    Advertisement

  2. UncleMike

    UncleMike Well-Known Member
    163

    Nov 15, 2009
    2,323
    483
    163
    Central NJ
    If statements in Tasker can't refer to contexts. You could simulate doing so by setting a variables:

    Context: Location <home>
    Enter Task: Variable Set %WHEREAMI = home
    Exit Task: Variable Clear %WHEREAMI

    Context: Location <work>
    Enter Task: Variable Set %WHEREAMI = work
    Exit Task: Variable Clear %WHEREAMI


    And then in some task use an if statement like:

    If $WHEREAMI Matches home/work


    As for running a non-Tasker widget from a Tasker task... you might be able to do it using "intents" in Tasker, but I'm not sure (or even optimistic).

    And for turning GPS off with a 30 minute delay after leaving home, you could use an exit task on your home profile, with a Wait followed by GPS Off, but you would need to set the task to keep the device awake in order for the task to complete as intended. This is because the Wait (as currently implemented) doesn't keep counting once the device goes to sleep. So in the long run it may be more battery efficient to just leave GPS on and let the device sleep.
     
    lambed3 and chrlswltrs like this.
  3. lambed3

    lambed3 New Member
    Thread Starter
    5

    Aug 23, 2010
    2
    0
    5
    thanks. Very helpful.
     
  4. chrlswltrs

    chrlswltrs Well-Known Member
    333

    Nov 12, 2009
    6,728
    1,790
    333
    Male
    Private Security
    Seattle
    I was just wondering this very thing today about using a profile as a context, thanks for this great explanation.
     
  5. BobMan

    BobMan New Member
    5

    Nov 9, 2012
    2
    0
    5
    Definitely late to this thread, but regarding the GPS, Map, navigation needs, this could be done pretty simply via the App context using the Secure Settings plug in. Just add the GPS apps you want to the context, then create a task using the Secure Settings plugin to enable GPS when the app is opened.

    Adding an exit task, again using the Secure Settings plugin to turn GPS etc. off when exiting. Works great! No need for location or time contexts (apologies if this is already covered).
     

Share This Page

Loading...