Quickstart

VERSION 1.0.0

The Search module provides easy-to-use APIs to add search functionality to your application. It is built on top of TomTom Search APIs and has offline support.

We also have an off-the-shelf UI component named SearchUI.

Project setup

Configure the project as described in the Project setup guide.

Then add the Search module dependency in the build.gradle.kts of your application module and synchronize the project.

implementation("com.tomtom.sdk.search:search-online:1.0.0")

Using the off-the-shelf UI

The SearchUi is a a module consisting of custom Search UI components. It offers a user interface that allows users to enter search keywords and select a result. To incorporate this module into your project, you must include the search-ui as a gradle dependency. To learn more about its usage, visit the SearchUi Guide.

Using Search module APIs

The Search module is composed of several modules. The search-api module provides the common API interfaces and types. The search-online module provides an online implementation of the Search interface.

Making search API calls

The OnlineSearch is highly configurable and supports various kinds of searches, for example, searching certain POIs by category, searching inside certain geometries, and searching along a route. It also provides auxiliary APIs such as autocompletion for brands and categories and for point of interest details.

To start using the API, initialize an OnlineSearch instance:

val searchApi = OnlineSearch.create(context, "YOUR_API_KEY")

With the onlineSearch instance, a search request with geobias can be done like:

1val options = SearchOptions(
2 query = "TomTom",
3 geoBias = GeoPoint(latitude = 52.377956, longitude = 4.897070),
4 limit = 5
5)
6
7search.search(
8 options,
9 object : SearchCallback {
10 override fun onSuccess(result: SearchResponse) {
11 /* handle success */
12 }
13
14 override fun onFailure(failure: SearchFailure) {
15 /* handle failure */
16 }
17 }
18)