-
Notifications
You must be signed in to change notification settings - Fork 14
Own function in Track screen
Jiří M. aka Menion edited this page Feb 8, 2019
·
4 revisions
Locus API offers an option to register own action in the menu of opened track screen. Thanks to this, when tapped your application receive ID of current active track. Thanks to this, the track may be loaded or used for navigation/Guidance etc.
1. Register intent-filter for your activity
<intent-filter>
<action android:name="locus.api.android.INTENT_ITEM_TRACK_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.isIntentTrackTools(intent)) {
// load whole track
val track = IntentHelper.getTrackFromIntent(this, intent)
if (track != null) {
// we have track, have fun
} else {
// problem with loading of track
}
// OR just obtain trackId value for post process
val trackId = IntentHelper.getItemId(intent)
...
}
}
-
Basics
-
Non-API tools
-
Using API
-
Work with points
-
Work with tracks
-
Integration into Locus Map
-
Other/advanced features