-
Notifications
You must be signed in to change notification settings - Fork 14
Action tasks (Broadcasts)
Android Broadcasts is a mechanism through which applications in Android communicate. One application may send to second (or also internally between its own components) piece of information bundled in the [Intent] object. The mechanism of how are data send is called broadcasting.
Samples at bottom.
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 a defined tasks
parameter with a well-formatted JSON object. Tasks usually have other parameters. In most cases, it is action
parameter that defined the sub-action. More in the definition below.
Every single task may have defined only a single action
parameter with additional extra parameters. The list below displays all available tasks
and their possible actions
.
Locus Map/Classic 3.38+
action: "on"
name: "Name of dashboard"
Display dashboard defined by its name over the main map screen.
action: "off"
Just hide the current active dashboard. Nothing happens if no dashboard is active.
value: "[name]"
Start certain "big" function (from internally defined functions, like these available for the functions panel), defined by its unique text ID.
Possible values:
-
altitude_manager
: app altitude manager -
quick_action_menu
(deprecated, use 'floating_menu' below) : action menu for fast access for predefined functions (since 3.36.0) -
floating_menu
: action menu for fast access for predefined functions (since 3.53/4.2) -
screen_compass
: screen with compass -
screen_data
: screen with users points/tracks, opened on last visible tab -
screen_data_points
: screen with users points -
screen_data_tracks
: screen with users tracks -
screen_gps
: screen with GPS skyplot -
screen_map_items
: screen with "Map items" system -
screen_maps
: main app map manager -
screen_store
: Locus Store for download/purchase of additional content
Locus Map/Classic 3.49+
-
name: "Name of point"
(optional) lon: "Geographic longitude (-180°;180°)"
lat: "Geographic latitude (-90°;90°)"
Start guide to a certain point defined by name and coordinates.
Locus Map 4.17
action: "on"
Turn on the GNSS unit.
action: "off"
Turn off the GNSS unit.
action: "toggle"
Toggle the state of the GNSS unit.
action: "start"
name: "Name of configuration"
Start Asamm based Live tracking defined by "profile ID" identification. Value is visible in the app UI, in the detail of the tracking profile at the bottom.
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).
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).
action: "on"
Enable map centering.
action: "off"
Disable map centering.
action: "toggle"
Toggle map centering.
Locus Map 4.18
action: "toggle_last"
Switch the current map to the previously selected map. So it is easy to toggle between current and previous map.
value: [+,-]X
-
unit: "[%,dp,px]"
(optional, default:px
) -
keep_centering: "[true/false]"
(optional, default:false
)
Move the map in X-axis direction (+
=> right), by the defined X
value. Optional units modify value
. The optional parameter keep_centering
allows keeping enabled "hold center".
value: [+,-]X
-
unit: "[%,dp,px]"
(optional, default:px
) -
keep_centering: "[true/false]"
(optional, default:false
)
Move the map in Y-axis direction (+
=> bottom), by the defined X
value. Optional units modify value
. The optional parameter keep_centering
allows keeping enabled "hold center".
Locus Map/Classic 4.2/3.53
move_by_x: [+,-]X
-
move_by_x_unit: "[%,dp,px]"
(optional, default:px
) move_by_y: [+,-]X
-
move_by_y_unit: "[%,dp,px]"
(optional, default:px
)
or
move_to_lon: "Geographic longitude (-180°;180°)"
move_to_lat: "Geographic latitude (-90°;90°)"
optional
-
zoom: [0;24]
(optional, default:-1
) -
animate: "[true/false]"
(optional, default:true
) -
keep_centering: "[true/false]"
(optional, default:false
)
Complex action that is able to move and zoom with the map. It is necessary to follow these conditions:
- there has to be defined movement, otherwise, the task will fail
- use 'move_by' for relative movement with the map or 'move_to' for absolute movement to a certain location
- change of the zoom is an optional parameter
-
keep_centering
is also optional and allows keeping enabled "hold center"
Suggestion: do not use it for repeated actions (like the long-press of the hardware button), because there is no guarantee, that the previous task will be 100% finished. For quick relative movement of the map without any delay (useful for repeated long-press calls for example), use map_move_x
and map_move_y
actions.
Locus Map 4.18
action: "on"
Turn the map overlay on.
action: "off"
Turn the map overlay off.
action: "toggle"
Switch the enabled/disabled state of the map overlay.
Locus Map 4.18
No parameters are defined here. This is a useful method for map theme creators. It allows you to easily refresh the current map with the theme from the disk. So call this right after you upload an updated version of the theme into the app directory and you need to reload it to see changes.
Locus Map/Classic 3.38+
Enable map rotation.
action: "off"
Disable map rotation.
action: "toggle"
Toggle map rotation.
action: "+"
Perform zoom-in action.
action: "-"
Perform zoom-out action.
action: "value"
Zoom to a certain value (in range [0;24]
).
Sample tasks: { map_zoom: { action: "value", value: "20" } }
Locus Map/Classic 3.51+
-
name: "Name of point"
(optional) lon: "Geographic longitude (-180°;180°)"
lat: "Geographic latitude (-90°;90°)"
Start the "Navigate to" screen to a certain pre-set point defined by name and coordinates. There is still a need to manually trigger the start of navigation in the UI.
Locus Map/Classic 3.51+
action: "nearest_point"
Find the nearest point along the active route and set it as the current navigation target.
action: "recalculate"
Recalculate current active navigation.
action: "stop"
Stop current navigation.
action: "menu"
Open app main menu.
Locus Map/Classic 4.2+/3.53+
action: "start"
Start the POI Alert feature with the last used parameters.
action: "stop"
Stop the POI Alert feature.
action: "start"
name: "Name of preset"
Activate preset defined by its name.
Locus Map 4.0+
Execute a certain quick bookmark defined by its name.
action: "start"
name: "Name of the bookmark"
action: "on"
Enable screen lock on the main screen.
action: "off"
Disable screen lock on the main screen.
- or
action: "toggle"
Toggle visibility of the screen lock on the main screen.
action: "on"
Turn screen on.
- or
action: "off"
Turn screen off.
- or
action: "toggle"
Toggle screen on/off state.
action: "start"
-
name: "My profile"
(optional)
Check if the optional name
is defined. If so, try to set a 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 missing, the value from the profile is used). If name
is also defined, the recording will be stopped only in case, profile with the same name is currently active.
action: "pause"
-
name: "My profile"
(optional)
Pause active track recording. If name
is also defined, the recording will be paused only in case, profile with the same name is currently active.
action: "discard"
-
name: "My profile"
(optional) confirm: [true,false]
Discard the current active track recording. Parameter confirm
specify, if user confirmation is needed. In case, the application is currently not visible, track recording is always discarded without confirmation. If name
is also defined, the recording will be discarded only in case, profile with the same name is currently active.
action: "toggle"
-
allow_start: [true,false]
(optional, Locus Map 3.38+)
Allow toggling recording state. If the recording is running
, pause it, otherwise if is paused
, un-pause it. When recording is not running at all, nothing happens if parameter allow_start
is not set to true
action: "add_wpt"
-
name: "Point name"
(optional) -
description: "Point description"
(optional) -
auto_save: [true,false]
(optional) -
action_after: "[audio,photo,video]"
(optional)
Add waypoint to the 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. In the case auto_save
is enabled, action_after
is ignored.
Locus Map 4.15+
-
lon: "Geographic longitude (-180°;180°)"
(optional) -
lat: "Geographic latitude (-90°;90°)"
(optional)
Start the "Weather" screen with a certain pre-defined location. The current map screen center is used when coordinates are invalid (or not defined).
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
).
The intent may have also defined a 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
action: com.asamm.locus.ACTION_TASK
extra: tasks: { map_zoom: { action: "+" } }
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: "%" } }
action: com.asamm.locus.ACTION_TASK
extra: tasks: { track_record: { action: "start", name: "Hiking" } }
action: com.asamm.locus.ACTION_TASK
extra: tasks: { function: { value: "quick_action_menu" } }
action: com.asamm.locus.ACTION_TASK
extra: tasks: { function: { value: "screen_compass" }, guide_to: { name: "My point", lon: 50.12345, lat: 15.12345 } }
-
Basics
-
Non-API tools
-
Using API
-
Work with points
-
Work with tracks
-
Integration into Locus Map
-
Other/advanced features