Bixby Developer Center

References

Location Autosuggest (viv.location)

The viv.location library provides:

This reference lists out several of the models available in this library capsule. Some sections contain tables listing information about those concepts or actions.

Models

Autosuggest Action

InputTypeNotes
searchTermSearchTermRequired
isFuzzyMatchAddressTypebooleantrue: use fuzzy matching for Geo addresses
isSearchGeoLocationsbooleantrue: search geo locations

Concepts

There are matching primitive concepts for each of the Autosuggest inputs.

ConceptTypeDescription
SearchTermtextterm used to search for contacts or locations
IsFuzzyMatchAddressTypebooleantrue: use fuzzy matching for Geo addresses
IsSearchGeoLocationsbooleantrue: search geo locations

Usage

The viv.location library imports viv.geo.

Note

Accessing the user's contacts requires the contacts library permission from bixby.contact. Read bixby.contact documentation for more details. If this permission is not granted, Autosuggest can still autocomplete named locations.

The recommended way to use the auto-complete functionality of viv.location is to use the provided location:Autocomplete macro.

input-view {
match: DestinationPoint

message ("Where would you like to go?")

render {
macro (location:Autocomplete) {
param (noResultText) {
dialog-template ("No results")
}
param (placeholder) {
dialog-template ("Search for locations")
}
select-button-text {
template ("Ok")
}
}
}
}

View master on GitHub

The macro takes three text parameters:

  • noResultText: displayed when there are no possible results for the completion as entered by the user. The default is "No results".
  • placeholder: The placeholder text used for the auto-complete field. The default is "Search for locations".
  • searchResultsLabel: The label used as a title for the search results. The default is "Search Results".

While it is recommended that you use the macro, you can create your own auto-complete component that uses the Autosuggest action. The macro creates one similar to the following:

...
auto-complete {
type (geo.NamedPoint)
no-result-text { template ("No results") }
placeholder { template ("Search for locations") }
source {
collect-with (query) {
intent {
goal: Autosuggest
value: SearchTerm$expr (query)
value: IsFuzzyMatchAddressType (true)
}
}
label { template ("Search Results") }
where-each (place) {
display {
primary-text { template ("[#{value(place.name)}]") }
secondary-text { template ("[#{value(place.address)}]") }
}
on-select {
intent {
goal: geo.NamedPoint
value: viv.core.FormElement (place)
}
}
}
permissions {
library-permission (contact:contacts)
library-permission (self:profile)
}
}
}
...

By default, the Autosuggest action will use location data to help resolve suggestions. You can disable this by setting IsSearchGeoLocations to false in the intent block:

intent {
goal: location.Autosuggest
value: location.SearchTerm$expr (query)
value: location.IsSearchGeoLocations (false)
}

If you disable isSearchGeoLocations, then Autosuggest will not be able to autocomplete locations.

Setting IsFuzzyMatchAddressType to true will allow "fuzzy matching" for address types such as home and office. This is set to true by the location:Autocomplete macro, but it defaults to false.