Tasker Integration

Overview

Tasker is an extremely powerful tool to automate things on your Android device

GPSLogger has built in location based autostart capabilities by itself - so you don’t have to use Tasker for that, but of course if you want to give Tasker the control, you can do so. Please see launching GPSLogger with an additional START or STOP logging command for details.

Whatever you choose, GPSLogger has the option to define Tasker tasks that should be called, once certain events occur while your recording. The following events allow you to define Tasker Tasks:

The Tasker Tasks for Start, Stop, Pause & Resume can be configured in the Application Settings > General Settings > Tasker-Integration, the Location Event Tasker Task has to be enabled and configured in the Application Settings > Sharing Location Information Section. Each time the app would send an eMail the selected TASKER-TASK will also be executed.

Provided Variables

Whenever a Tasker task is called there is the possibility to provide additional variables to the task. GPSLogger will currently provide the following:

The %action Variable

You can use a single TaskerTask and distinguish by the action variable what you would like to do.

event action value
start logging %action = start
stop logging %action = stop
pause logging %action = pause
resume logging %action = continue
share location %action = notify
variable condition / description / sample
%raw_latitude plain decimal latitude value
%raw_longitude plain decimal longitude value
%latitude if no projection is configured / formatted latitude string (as shown in status bar)
%longitude if no projection is configured / formatted longitude string (as shown in status bar)
%mgrsprojection if MGRSProjection is used / location in the MGRSProjection display format
%zone if other Projection then MGRS is used
%north if other Projection then MGRS is used
%east if other Projection then MGRS is used
%raw_altitude  
%altitude (as shown in status bar)
%raw_heading  
%heading (as shown in status bar)
%raw_speed  
%speed (as shown in status bar)
%raw_clock plain UTC timestamp - as long number
%clock formatted local time (as shown in status bar)

Additional variables when you are recording a path

variable condition / description / sample
%raw_duration duration of the activity in milliseconds
%duration formatted duration of the activity (as shown in status bar)
%raw_distance  
%distance (as shown in status bar)
%raw_climb if available
%climb if available (as shown in status bar)
%raw_totaltime  
%totaltime (as shown in status bar)

Additional variables from external sensors

variable condition / description / sample
%raw_hr if available & when using HR as %
%hr if available /
%cad if available / Bike Cadence as an integer number (in rpm)
%pow if available / Bike Power as an integer number (in watts)

Start & Stop GPSLogger recording from a shell command line

To start or stop GPSLogger recording you can send the very simple shell command: am start -n com.emacberry.gpslogger/.GPSLoggerActivity --ez stopLogging true -f 536870912

When the app is recoding, then the recording will be stopped - if the app is not recording (and ist not in the view-mode) then the recording will be started. Please note, that STOP-recording might be intercepted with a confirm dialog. The -f is the FLAG option and we will send the FLAG_ACTIVITY_SINGLE_TOP (which has the int value 536870912) - as alternative the --activity-single-top can be used.

Need more control?

If you want to have more control over start/stop behaviour (and do not like to use the simple toggle) you can make use of this alternative shell command lines:

Start logging

am start -a intent.action.STARTREC -n com.emacberry.gpslogger/.GPSLoggerActivity -f 536870912

Stop logging

am start -a intent.action.STOPREC -n com.emacberry.gpslogger/.GPSLoggerActivity -f 536870912

Start & Stop GPSLogger recording from TASKER

Please use the following intent details if you want to launch GPSLogger and trigger START or STOP from Tasker:

Start Recording Intent

<intent
    android:action="intent.action.STARTREC"
    android:targetPackage="com.emacberry.gpslogger"
    android:targetClass="com.emacberry.gpslogger.GPSLoggerActivity"
/>

Stop Recording Intent

<intent
    android:action="intent.action.STOPREC"
    android:targetPackage="com.emacberry.gpslogger"
    android:targetClass="com.emacberry.gpslogger.GPSLoggerActivity"
/>

So as an example, when you want to start logging via Tasker you have to specify in the Tasker Action-Dialog:

Action intent.action.STARTREC
Cat none
Package com.emacberry.gpslogger
Class com.emacberry.gpslogger.GPSLoggerActivity

A Example Tasker Script from GPSLogger User napalmfires

See Forum Post: “Tasker integration basics” (by napalmfires)

Direct download link to the Scripted provided by napalmfires - use it at your own RISK

Version: 2023/03/19