Skip to content

Own function in Points screen

Jiří M. aka Menion edited this page Feb 8, 2019 · 1 revision

Locus API offers an option to register own action in the menu of the opened screen with the list of points. Thanks to this, when tapped, your application receives a list of pointId values.

Workflow

1. Register intent-filter in your activity

<intent-filter>
    <action android:name="locus.api.android.INTENT_ITEM_POINTS_SCREEN_TOOLS" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

2. Handle received click in your activity as follows:

public override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    ...

    // check intent that started activity
    if (IntentHelper.isIntentPointsTools(intent)) {

        // load whole track
        val pts = IntentHelper.getPointsFromIntent(this, intent)
        if (pts != null) {
            // we have list of points (it's ID), have fun
        } else {
            // problem with loading of the points
        }
    }
}