Skip to content

Common simple tasks

Jiří M. aka Menion edited this page Feb 12, 2020 · 7 revisions

Last update: API 0.9.0

Check the first steps to get a basic overview of common patterns in Locus API.

Get app core information

Object LocusInfo hold all core information about certain Locus Map application.

val locusInfo = ActionBasics.getLocusInfo(ctx, lv)

With known LocusInfo, you may get answers on

Is Locus running?

locusInfo.isRunning()

Where is the Locus Map root directory

locusInfo.getRootDirectory()

And so on. Check Javadocs for LocusInfo object to see all available options.

Get app statistics

Object UpdateContainer hold a lot of various information about the current map view, location, navigation system etc.

val uc = ActionBasics.getUpdateContainer(ctx, lv)

The container is re-generated once per 1/2 second, so more frequent requests result in the same object.

Fast work with certain version after received intent

Since Locus version 279, all intents that Locus send contains it's packageName, so you may use

val lv = LocusUtils.createLocusVersion(ctx, intent)

to immediately construct required LocusVersion from received intent.

Start Locus Map if not running

LocusUtils.callStartLocusMap(ctx)
Clone this wiki locally