Bring your own data
Custom 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.19.0")
Note that the custom POI functionality requires access to the Offline functionality.
Follow the instructions in the Quickstart guide to set up access in your project.
Add the following import to your Kotlin file
import com.tomtom.sdk.search.online.custompoi.create
Then create a list of CustomPOI
s and add them to the provider.
1val customPOIs =2 setOf(3 CustomPoi(4 id = "custom-1",5 place =6 Place(7 coordinate = GeoPoint(latitude = 52.12, longitude = 4.8),8 address =9 Address(10 streetName = "Toccatastraat",11 streetNumber = "14",12 countryCodeIso3 = "NLD",13 municipality = "Almere",14 ),15 entryPoints =16 listOf(17 EntryPoint(18 EntryType.Main,19 GeoPoint(latitude = 52.121, longitude = 4.81),20 ),21 ),22 ),23 poi =24 Poi(25 names = setOf("custom poi 1"),26 ),27 ),28 )2930customPoiDataProvider.setCustomPois(customPOIs)
And finally, initialize the TomTom Online Search module with the newly created custom POI provider.
1val searchApiWithCustomDataProvider =2 OnlineSearch.create(3 context,4 "YOUR_TOMTOM_API_KEY",5 listOf(customPoiDataProvider),6 )
Next steps
Since you have learned how to work with custom POI details, here are recommendations for the next steps: