Skip to content

App as Search source

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

Locus Map has a unique search screen, with many search options. Among sources already builded inside the application, Locus API offers the option to integrate your own search system into the Locus Map app.

Workflow

1. Register intent-filter in your activity

<intent-filter>
    <action android:name="locus.api.android.INTENT_ITEM_GET_LOCATION" />
    <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.isIntentSearchList(intent)) {

        // handle received intent
        IntentHelper.handleIntentSearchList(act, intent,
                object : IntentHelper.OnIntentReceived {

                    override fun onReceived(lv: LocusUtils.LocusVersion, locGps: Location?, locMapCenter: Location?) {
                        // handle received intent with known LocusVersion and optional users locations
                    }

                    override fun onFailed() {
                        // invalid intent or any other problem
                    }
                })
    }
}

3. Result of internal search in your add-on should be directly published into Locus world. There is currently no option to display search results back in Locus Map.