1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

I can get location, but there are always tears (Tasker question)


Last Updated:

  1. A.Nonymous

    A.Nonymous Well-Known Member This Topic's Starter

    Joined:
    Jun 7, 2010
    Messages:
    7,061
    Likes Received:
    965
    I'm trying to get location in Tasker. I can get location, but there are always tears involved. Sometimes there is also gnashing of teeth that goes along with the weeping.

    Basically, what I'm trying to accomplish is a task that will execute every time I leave my office and get in the car. The car adapter is recognized as AC power. So, I need to get an accurate location otherwise it'll go off when I'm at a client site. I've been working on this off and on for a month or more and I'm very tempted to write it off as completely undoable. This is what I've tried so far:

    Context:
    Power = AC
    Load app = Mileage tracking app (I track my mileage for work.)
    Wifi near = work wifi.

    This worked beautifully and launched the task when I left my office. Then it launched it again an hour later when I got back into my car at the client site which is about a 20 min drive away. So I figured I'd go back to the drawing board and came up with this:

    Power = AC
    Load app = Mileage tracking app
    Wifi near = work wifi
    Network loc = network location from my office

    This worked better. I was able to drive 20 mins and the task wouldn't go off. However when I drove just a few mins away, the task still went off when I got back into the car. So, I sad screw it and tried this:

    Power = AC
    Load app = Mileage tracking app
    GPS = Work location

    I was a bit concerned that this might drain my battery, but I figured that it would only check my GPS location if I was on AC power. I figured this would be no biggie. The problem is that this doesn't work either. It still goes off 20-30 mins after I've left the office.

    What can I do to get an accurate location without any tears involved?
     

    Advertisement
  2. UncleMike

    UncleMike Well-Known Member

    Joined:
    Nov 15, 2009
    Messages:
    2,319
    Likes Received:
    482
    I may be confusing you with someone else, but I seem to recall seeing something like this a few versions ago, when the 'Get Location' action was no implemented.

    You might want to try something like this:

    Context: Power AC
    Enter Task:
    GPS On
    Get Location [ Source:GPS Timeout:100 ]
    Variable Set ACGPS = 1 If (%TIMES - %LOCTMS) < 10
    Wait 30 seconds
    Variable Clear %ACGPS

    Context: Variable Value %ACGPS = 1
    Context: Location <work>
    Enter Task:
    Load App [ Mileage Tracking App ]

    Every time you plug into AC, Tasker will try to get a current GPS fix. If it's successful, it will set the %ACGPS variable to 1, which will allow the second profile to activate ONLY IF you're at work. Clearing the variable after 30 seconds will prevent the second profile from activating when you plug in somewhere else and subsequently arrive at work.
     
  3. A.Nonymous

    A.Nonymous Well-Known Member This Topic's Starter

    Joined:
    Jun 7, 2010
    Messages:
    7,061
    Likes Received:
    965
    That actually looks ridiculously simple. I'll implement that and smack myself in the head with a blunt instrument for not thinking it up myself. That is if it works anyway.

    Edit: Ok, where's Get Location located at? I can't find it.
     
  4. UncleMike

    UncleMike Well-Known Member

    Joined:
    Nov 15, 2009
    Messages:
    2,319
    Likes Received:
    482
    It's under 'Misc'.
     
  5. amlothi

    amlothi Well-Known Member

    Joined:
    Jul 23, 2010
    Messages:
    1,185
    Likes Received:
    201
    I was wondering if you ever got this figured out from the other thread. I understand that you are just trying to get it to work, but there's an obvious questions here that seems important to me.

    Why are these two contexts becoming active again when you are not near your office?


    I have to think there is something going on with your Wifi Near context. I know it will take some time (2 scanning cycles) for the Wifi Near context to drop out after you leave the office. That shouldn't matter though, because you will remain in the profile during that time, so your task won't fire again.

    In order for your task to fire again you need to drop out and then re-enter your profile somehow.

    The only way I see this happening is, you drive somewhere, close the app (or unplug your phone) and this causes the profile to become inactive.

    Then you plug in again (or start the app) and the profile activates because the Wifi Near status still hasn't cleared.

    It looks, to me, like either of your first two options should work.

    Perhaps you just need to adjust the Wifi scanning settings in Tasker to scan for Wifi Near more often so that this doesn't happen.


    Another suggestion:


    Context:
    Power = AC
    Load app = Mileage tracking app (I track my mileage for work.)
    Wifi near = work wifi

    Task = Set Variable Value


    Context:
    Variable Value

    Task = Fire Task (SMS message?)



    Context:
    Wifi Near (home)

    Task = Clear variable



    This way, the task should only fire once when the variable is set. The variable will remain set until you are at home, so if the first profile becomes active again, the second one shouldn't fire a second time.
     

Share This Page

Loading...