Bring your own data
Request accessCustom POIs are points of interest that are specific to the application. The TomTom Search modules offer the functionality to create and incorporate custom POIs into the search process, allowing them to be utilized alongside the existing pool of available POIs.
To use custom POIs, add the following module dependency in the build.gradle.kts of your application module and synchronize the project.
implementation("com.tomtom.sdk.search:search-custom-data-online:1.26.4")Add the following import to your Kotlin file
import com.tomtom.sdk.search.online.custompoi.createThen create a list of CustomPOI s and add them to the provider.
val customPOIs = setOf( CustomPoi( id = "custom-1", place = Place( coordinate = GeoPoint(latitude = 52.12, longitude = 4.8), address = Address( streetName = "Toccatastraat", streetNumber = "14", countryCodeIso3 = "NLD", municipality = "Almere", ), entryPoints = listOf( EntryPoint( EntryType.Main, GeoPoint(latitude = 52.121, longitude = 4.81), ), ), ), poi = Poi( names = setOf("custom poi 1"), ), ), )
customPoiDataProvider.setCustomPois(customPOIs)And finally, initialize the TomTom Online Search module with the newly created custom POI provider.
val searchApiWithCustomDataProvider = OnlineSearch.create( context, "YOUR_TOMTOM_API_KEY", listOf(customPoiDataProvider), )Next steps
Since you have learned how to work with custom POI details, here are recommendations for the next steps: