Action tasks (Broadcasts)

Jiří M. aka Menion edited this page Aug 28, 2018 · 11 revisions

Basic information

Android Broadcasts is a mechanism through which applications in Android communicate. One application may send to second (or also internally between own components) piece of information bundled in [Intent] object. Mechanism how are data send is called broadcasting.

Samples at bottom.

How to

Locus Map since version 3.31 supports the new bunch of commands, that are received as Broadcast intent with defined tasks & actions to do.

Every broadcast has to have defined tasks parameter with well formatted JSON object. Tasks usually have other parameters. In most cases, it is action parameter that defined sub-action. More in the definition below.

Every single task may have defined only single action parameter with additional extra parameters. List below display all available tasks and it's possible actions.

Tasks

map_center

  • action: "on"

Enable map centering.

  • action: "off"

Disable map centering.

  • action: "toggle"

Toggle map centering.

live_tracking_asamm

  • action: start
  • name: "Name of configuration" (optional)

Start Asamm based Live tracking, optionally with the certain configuration defined by name (won't start if named configuration does not exist).

  • action: stop
  • name: "Name of configuration" (optional)

Stop Asamm based Live tracking, optionally with the certain configuration defined by name (won't stop if named configuration is not running).

live_tracking_custom

  • action: start
  • name: "Name of configuration" (optional)

Start custom based Live tracking, optionally with the certain configuration defined by name (won't start if named configuration does not exist).

  • action: stop
  • name: "Name of configuration" (optional)

Stop custom based Live tracking, optionally with the certain configuration defined by name (won't stop if named configuration is not running).

map_move_x

  • value: [+,-]X
  • unit: "[%,dp,px]" (optional)

Move map in X-axis direction (+ => right), by defined X value. Optional units modify value.

map_move_y

  • value: [+,-]X
  • unit: "[%,dp,px]" (optional)

Move map in Y-axis direction (+ => bottom), by defined X value. Optional units modify value.

map_zoom

  • action: "+"

Perform zoom-in action.

  • action: "-"

Perform zoom-out action.

  • action: "value"

Zoom to certain value (in range [1-26])

open

  • action: "menu"

Open app main menu.

preset

  • action: "start"
  • name: "Name of preset"

Activate certain preset defined by its name.

screen_lock

  • action: "on"

Enable screen lock on main screen.

  • or action: "off"

Disable screen lock on main screen.

screen_on_off

  • action: "on"

Turn screen on.

  • or action: "off"

Turn screen off.

  • or action: "toggle"

Toggle screen on/off state.

track_record

  • action: "start"
  • name: "My profile" (optional)

Check if optional name is defined. If so, try to set recording profile with the same name. In case of fail, ends this task. As the second step, start recording if it's not currently running.

  • action: "stop"
  • name: "My profile" (optional)
  • auto_save: [true,false] (optional)

Stop track recording, optionally with automatic save of track. If name is also defined, recording will be stopped only in case, profile with same name is currently active.

  • action: "pause"
  • name: "My profile" (optional)

Pause active track recording. If name is also defined, recording will be paused only in case, profile with same name is currently active.

  • action: "toggle"

Only work if recording is started. If recording is running, pause it, otherwise if is paused, un-pause it.

  • action: "add_wpt"
  • name: "Point name" (optional)
  • auto_save: [true,false] (optional)
  • action_after: "[audio,photo,video]" (optional)

Add waypoint to current active recording. Extra parameters are optional and may predefine point name, allow to save point automatically and also allows to take an audio/photo/video point directly.

Samples

Samples below show parameters that need to be defined for custom intents or for example for Tasker application. All intents need to be sent as broadcasts (in Tasker defined as Broadcast Receiver).

Intent may have also defined package parameter that say "which application should receive it". In case, you use Locus Map Free (Beta) and Locus Map Pro at once, or in case of target platform Android 8+, it is necessary to set this parameter too.

Locus Map Free (Beta): menion.android.locus

Locus Map Pro: menion.android.locus.pro

Zoom in map

action: com.asamm.locus.ACTION_TASK

extra: tasks: { map_zoom: { action: "+" } }

Move with map

to right and bottom by 25% of screen

action: com.asamm.locus.ACTION_TASK

extra: tasks: { map_move_x: { value: 25, unit: "%" }, map_move_y: { value: 25, unit: "%" } }

Start track recording

action: com.asamm.locus.ACTION_TASK

extra: tasks: { track_record: { action: "start", name: "Hiking" } }

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.