OfflineSearchEngine

The OfflineSearchEngine interface provides forward and reverse geocoding search that works offline. An instance of the OfflineSearchEngine can be obtained with OfflineSearchEngine.create.

The API of this class is temporary and subject to change. Tiles loading functionality is available to selected customers only. Contact our team, to get early preview.

Types

Link copied to clipboard
object Companion

Companion object.

Link copied to clipboard

Interface definition for a callback to be invoked when the OfflineSearchEngine is ready for use. With the current implementation the callback is invoked when previously downloaded offline data has been prepared and available for search.

Link copied to clipboard

Interface for a listener to be invoked when index data is changed in the OfflineSearchEngine. This interface notifies users when tiles changes made with com.mapbox.common.TileStore have been processed and visible in the OfflineSearchEngine.

Functions

Link copied to clipboard

Adds a callback to be notified when engine is ready. If the engine is already ready, callback will be notified immediately.

Link copied to clipboard

Adds a listener to be notified of index change events.

Link copied to clipboard
@MapboxExperimental
open fun categorySearch(categoryName: String, options: OfflineCategorySearchOptions, callback: OfflineSearchCallback): AsyncOperationTask
@MapboxExperimental
open fun categorySearch(categoryNames: List<String>, options: OfflineCategorySearchOptions, callback: OfflineSearchCallback): AsyncOperationTask
@MapboxExperimental
open fun categorySearch(categoryName: String, options: OfflineCategorySearchOptions, executor: Executor, callback: OfflineSearchCallback): AsyncOperationTask
@MapboxExperimental
abstract fun categorySearch(categoryNames: List<String>, options: OfflineCategorySearchOptions, executor: Executor, callback: OfflineSearchCallback): AsyncOperationTask

Performs category search request. Each new search request cancels the previous one if it is still in progress. In this case OfflineSearchCallback.onError will be called with com.mapbox.search.common.SearchCancellationException.

Link copied to clipboard

Removes a previously added callback.

Link copied to clipboard

Removes a previously added listener.

Link copied to clipboard
open fun retrieve(feature: Feature, callback: OfflineSearchResultCallback): AsyncOperationTask

Function to retrieve the details for a given mapboxId that dispatches events using the main executor. The callback will be invoked with a OfflineSearchResult on successful execution.

abstract fun retrieve(feature: Feature, executor: Executor, callback: OfflineSearchResultCallback): AsyncOperationTask

Function to retrieve the details for a given map feature. The callback will be invoked with a OfflineSearchResult on successful execution. An example usage would be resolving a location when a user clicks on a map in "offline" mode.

Link copied to clipboard
open fun reverseGeocoding(options: OfflineReverseGeoOptions, callback: OfflineSearchCallback): AsyncOperationTask
abstract fun reverseGeocoding(options: OfflineReverseGeoOptions, executor: Executor, callback: OfflineSearchCallback): AsyncOperationTask

Performs reverse geocoding search request. Each new search request cancels the previous one if it is still in progress. In this case OfflineSearchCallback.onError will be called with com.mapbox.search.common.SearchCancellationException.

Link copied to clipboard
open fun search(query: String, options: OfflineSearchOptions, callback: OfflineSearchCallback): AsyncOperationTask
abstract fun search(query: String, options: OfflineSearchOptions, executor: Executor, callback: OfflineSearchCallback): AsyncOperationTask

Performs forward geocoding search request. Each new search request cancels the previous one if it is still in progress. In this case OfflineSearchCallback.onError will be called with com.mapbox.search.common.SearchCancellationException.

Link copied to clipboard
open fun searchAddressesNearby(street: String, proximity: Point, radiusMeters: Double, callback: OfflineSearchCallback): AsyncOperationTask
abstract fun searchAddressesNearby(street: String, proximity: Point, radiusMeters: Double, executor: Executor, callback: OfflineSearchCallback): AsyncOperationTask

Searches for addresses nearby (around proximity point), matched with specified street name. Each new search request cancels the previous one if it is still in progress. In this case OfflineSearchCallback.onError will be called with com.mapbox.search.common.SearchCancellationException.

Link copied to clipboard
@MapboxExperimental
open fun searchAlongRoute(query: String, options: OfflineSearchAlongRouteOptions, callback: OfflineSearchCallback): AsyncOperationTask
@MapboxExperimental
abstract fun searchAlongRoute(query: String, options: OfflineSearchAlongRouteOptions, executor: Executor, callback: OfflineSearchCallback): AsyncOperationTask

Performs a search along the supplied in the options route.

open fun searchAlongRoute(query: String, proximity: Point, route: List<Point>, callback: OfflineSearchCallback): AsyncOperationTask
abstract fun searchAlongRoute(query: String, proximity: Point, route: List<Point>, executor: Executor, callback: OfflineSearchCallback): AsyncOperationTask

Deprecated: Use an overloaded function that accepts OfflineSearchAlongRouteOptions as a parameter instead. If you choose to use this function, it is recommended to set the first point of the route as the proximity for future compatibility. In upcoming SDK updates, the semantics of the proximity parameter will change.

Link copied to clipboard
@MapboxExperimental
abstract fun selectTileset(tilesetParameters: TilesetParameters)
abstract fun selectTileset(dataset: String?, version: String?)

Selects preferable tileset for offline search. If dataset or version is set, OfflineSearchEngine will try to match appropriate tileset and use it. If several tilesets are available, the latest registered will be used.

Properties

Link copied to clipboard

Settings used for OfflineSearchEngine initialization.