Tutorials

How To Create A Geofence Name Getter Child Task

Creating a Tasker child task is always helpful. This is more apparent in larger projects. Follow the steps below to create your own geofence name getter child task and parent task in order to see the results.

 

Objective




Create a child task that acts as a getter, which will return the geofence name you are currently inside of.

Required Apps

  • Tasker
  • AutoLocation

Steps

Setup

  • Open AutoLocation and create a geofence around your own location with any distinct name

Create The Task

  • Create a new Task:
    • “Get Geofence Name”
    • Action 1 – AutoLocation Info:
      • Geofence Status > Geofence Status: Checked
    • Action 2 – Variable Set:
      • Name: “%geofence_number”
      • To: “%alstatusesdesc(#?Inside)”
    • Action 3 – If:
      • Condition: “%geofence_number = 0”
    • Action 4 – Flash
      • Text: “You are not in a geofence!”
    • Action 5 – Else If:
      • Condition: “%geofence_number != 0”
    • Action 6 – Variable Set:
      • Name: “%geofence_name”
      • To: “%algeofences(%geofence_number)”
    • Action 7 – Return:
      • Value: “%geofence_name”
    • Action 8 – End If:
      • No configuration

Test Out Get Geofence Name Getter

  • Create a new
    • Task: “Test”
  • Action 1 – Perform Task:
    • Name: “Get Geofence Name”
    • Return Value Variable: %name
  • Action 2 – Flash
    • Text: “%name”
  • Try it again by executing the task when you are not inside a geofence. The resultant flashes “You are not in a geofence!”
  • Try it again while inside other geofences. The resultant flashes [your geofence name]

Use Cases




Now that you have a method for getting the geofence name apply it to different situations. Include it into parent tasks to react accordingly. Get the geofence name to place it in a notification’s text, a homescreen widget, or make it an if-statement conditional.  Personally, I use it for a number of profiles and tasks. I apply it to KLWP homescreen texts, set it as a notification’s title for the following geofences: gym, grocery store, work site, office, and home. I also receive notifications from my home automation system only if I’m NOT inside a geofence.

As always, if you don’t want to do all the work above, download the XML project HERE
See below for my playlist of videos that illustrate the above steps.  Note that these videos are older and may not contain the exact names as stated above but will still convey the general idea.

Related Articles

What did you think???