Configure the Woosmap MultiSearch Android SDK
Explore available parameters and understand how to combine the different autocomplete services on Android
API options
For each API configuration you can apply the same optional parameters as defined in the dedicated REST API’s documentation.
Documentation:
Configuring a Provider
A provider is a wrapper around a Woosmap API or a Google API which will be called to return the result for a query or
get details of a place. Each provider must be created from a provider configuration and this provider must then be
passed to MultiSearch object by calling MultiSearch.addProvider method. Use ProviderConfig.Builder class in order
to create a provider configuration.
ProviderConfig.Builder builder;
builder = new ProviderConfig.Builder(SearchProviderType.ADDRESS)
.key(getString(R.string.woosmap_private_key))
Required Parameters
type: Type of the provider. Passed asSearchProviderTypeenum.key: Your project’s private key. This key identifies your Woosmap Project for purposes of quota management.
Optional Parameters
fallbackBreakpoint: A number between 0 and 1 corresponding to the threshold of fallback.minInputLength: minimum input length before executing autocomplete provider.param(typeConfigParam): to bias the API and search for specific regions or languages. Check each provider to see available parameters.
Woosmap Address Provider
To create a configuration for Woosmap Address provider use the search type parameter SearchProviderType.ADDRESS:
builder = new ProviderConfig.Builder(SearchProviderType.ADDRESS)
.key(getString(R.string.woosmap_private_key))
Available Provider parameters
components: to filter over countries.language: in which language the results should be returned. Searches are also biased to the selected language.fields: to limit content of responses to the geometry part.
Example Woosmap Address Provider
builder = new ProviderConfig.Builder(SearchProviderType.ADDRESS)
.key(getString(R.string.woosmap_private_key))
.fallbackBreakPoint(0.8f)
.minInputLength(1)
.component(new Component(new String[]{"FR"},"fr"));
multiSearch.addProvider(builder.build());//Add Address provider
Woosmap Localities Provider
To create a configuration for Woosmap Localities provider use the search type parameter SearchProviderType.LOCALITIES:
builder = new ProviderConfig.Builder(SearchProviderType.LOCALITIES)
.key(getString(R.string.woosmap_private_key))
Available Provider parameters
types: the types of suggestion to return. Multiple types can be passed.components: to filter over countries.language: in which language the results should be returned. Searches are also biased to the selected language.data: choose betweenDataFormat.standardorDataFormat.extended.
Example Woosmap Localities Provider
builder = new ProviderConfig.Builder(SearchProviderType.LOCALITIES)
.key(getString(R.string.woosmap_private_key))
.minInputLength(1)
.component(new Component(new String[]{"FR"}))
.searchType("locality")
.searchType("country")
.searchType("postal_code");
multiSearch.addProvider(builder.build());//Add locality provider
Woosmap Store Provider
To create a configuration for Woosmap Store provider use the search type parameter SearchProviderType.STORE:
builder = new ProviderConfig.Builder(SearchProviderType.STORE)
.key(getString(R.string.woosmap_private_key))
Available Provider parameters
query: a search query combining one or more search clauses.
Example Woosmap Store Provider
builder = new ProviderConfig.Builder(SearchProviderType.STORE)
.key(getString(R.string.woosmap_private_key))
.ignoreFallbackBreakPoint(true);
multiSearch.addProvider(builder.build());//Add Store provider
Google Places Provider
To create a configuration for Google Places provider use the search type parameter SearchProviderType.PLACES:
builder = new ProviderConfig.Builder(SearchProviderType.PLACES)
.key(getString(R.string.places_key))
Available Provider parameters
types: the types of suggestion to return. Multiple types can be passed.components: to filter over countries.language: in which language the results should be returned. Searches are also biased to the selected language.
Example Google Places Provider
builder = new ProviderConfig.Builder(SearchProviderType.PLACES)
.key(getString(R.string.places_key))
.fallbackBreakPoint(0.7f)
.minInputLength(1)
.component(new Component(new String[]{"fr"}))
.language("it");
multiSearch.addProvider(builder.build());//Add places provider language: "it"))