-
Notifications
You must be signed in to change notification settings - Fork 14
Pick location from Locus Map
The feature may be used to obtain location from Locus Map app, from the same dialog a locus usually pick location. Because GetLocation dialog, used in Locus need to have already initialized whole core of Locus, this dialog cannot be called directly, but needs to be started from Main map screen. This screen have anyway flag android:launchMode="singleTask"
, so there is no possibility to use startActivityForResult in this way.
Be careful with this function, because Locus will after "pick location" action, call new intent with ON_LOCATION_RECEIVE
action, which will start your activity again without "singleTask" or similar flag.
1. Register intent-filter for your activity
<intent-filter>
<action android:name="locus.api.android.ACTION_RECEIVE_LOCATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
2. Request "Pick of location" on Locus Map from your activity.
ActionBasics.actionPickLocation(this)
3. Handle received click in your activity as follows:
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
// check intent that started activity
if (IntentHelper.isIntentReceiveLocation(intent)) {
// load received point
val pt = IntentHelper.getPointFromIntent(this, intent)
if (pt != null) {
// we have point (location), have fun
} else {
// problem with loading of the location
}
}
}
-
Basics
-
Non-API tools
-
Using API
-
Work with points
-
Work with tracks
-
Integration into Locus Map
-
Other/advanced features