Quickstart

VERSION 2.1.2

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.

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:2.1.2")

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 search: Search = TomTomSdk.createSearch()

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

1val options =
2 buildTextSearchOptions(
3 query = "TomTom",
4 geoBias = GeoPoint(latitude = 52.379189, longitude = 4.899431),
5 limit = 20,
6 )
7
8search.search(
9 options,
10 object : SearchCallback {
11 override fun onSuccess(result: SearchResponse) {
12 // handle success
13 }
14
15 override fun onFailure(failure: SearchFailure) {
16 // handle failure
17 }
18 },
19)
When using the Extended flavor

The Extended flavor of Maps and Navigation SDK for Android is only available upon request. Contact us to get started.

In the Extended flavor you may also configure search options using SearchOptions API directly. For more details, see the section on flavors.

1val searchOptions = SearchOptions(
2 route = routePoints,
3 categoryIds = setOf(CategoryId(StandardCategoryId.GasStation)),
4 maxDetourDuration = 15.minutes,
5)