Let’s start with the hypotetical 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 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 own Android application.
Related posts that may help with the practical part:
- 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 send.
Actions are defined as JSON object.
Key value is tasks. The
value itself is defined as 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
Actionis constant that will be handled by Locus Map itself (only)
Package: reguired identification of target application (restrictions since Android 8.0
Extra: define task itself “Biking”`
presetas identification of “work with Presets”. Mode precisely
starts preset named
track_recordas identification of “work with track recording system”. Mode precisely
starttrack-recording with profile names