Action tasks in action
… how to be geeky with Locus Map application
Let’s start with a hypothetical situation. You sit on the bike and now wants to enable certain recording profile, start map rotation, start GPS itself and so on. How to do it quickly without wasting a few minutes of changing old, not anymore used, settings?
There are solutions. One of the best is to use Presets. Anyway, if you want interesting kind of flexibility and feel little “geeky”, continue reading.
In 2018, we introduced a very interesting concept of controlling Locus Map over Broadcast intents, internally called Action tasks. Its possibilities are documented in our Locus API repository, but let’s try to use it practically for example for our task above.
Among the Locus Map application, you will also need a tool that is able to send configured intents to any other application. Tasker or MacroDroid are good examples. You may use this system also from your own Android application.
Related posts that may help with the practical part:
- in preparation…
- control map like zooming, centering, directly move with the map
- control Track recording system
- control Live tracking
- enable certain Preset
- open certain app screens
The feature is based on the core Android system called Broadcast intent. With this method, one application is able to send predefined data (text, numbers, …) to the second application. Values are usually stored in the internal container as key/value pairs.
Locus Map is able to catch defined intent and execute actions that another application require.
Actions are defined as a JSON object. `Key` value is `tasks`. The `value` itself is defined as a JSON object.
Sample of how parameters of `intent`, together with JSON object may look like is below. Some more samples may be found on the API documentation page.
Example of Action
- `Action` is constant that will be handled by Locus Map itself (only)
- `Package`: required identification of target application (restrictions since Android 8.0
- Extra: define task itself “Biking”`, where:
- `preset` as identification of “work with Presets”. Mode precisely `starts` preset named `Bike`.
- `track_record` as identification of “work with track recording system”.
- Mode precisely `start` track-recording with profile names `Biking`.
And that’s all. Hope you find mentioned method useful and enjoy your trips!