Bixby Developer Center

Location Search

This sample capsule highlights the following:

The best way to test this capsule is by using on-device testing so that Bixby can ask for your location, profile information, and contacts directly.

You can test this sample capsule in the Simulator with the following utterance:

"Find me a ride"

This is equivalent to this intent:

intent{
goal: FindRideShare
}

Download Capsule

Note

Because you cannot submit a capsule with the example namespace, in order to test a sample capsule on a device, you must change the id in the capsule.bxb file from example to your organization's namespace before making a private submission.

For example, if your namespace is acme, change example.locationSearch to acme.locationSearch.

Getting User Permissions

In order to access the user's current location, profile information, and contacts, you need to ask for permission in the capsule.bxb file to access that information:

  permissions {
device-location-access
library-permission (contact:contacts)
library-permission (self:profile)
}

View 4cad14d on GitHub

This automatically creates a prompt, in which the user can Allow or Deny the request for each permission.

Using Geo

The geo library capsule is used to create namedPoint concepts, namely the DestinationPoint and SourcePoint models used to determine the starting and ending point of the shared ride. Both concept models use role-of(geo.NamedPoint), so that they have the properties needed to be geographical points of interest.

In order to do this, you need to import the geo capsule:

  capsule-imports {
import (viv.location) { as (location) version (1.1.2)}
import (viv.geo) { as (geo) version-from (location)}
import (viv.self) { as (self) version-from (location) }

View 4cad14d on GitHub

Notice that the viv.geo capsule imports with the version-from the viv.location capsule, which ensures that capsule versions are compatible with each other.

Auto-Complete with Geo and Contact

This capsule also includes the DestinationPoint_Input.view.bxb file, which uses the auto-complete Views component coupled with contact and geo to automatically suggest locations for the DestinationPoint using the location.Autosuggest goal. Because location relies on geo for the Address property, the contact chosen can then be passed back as the DestinationPoint.

Video Tutorial: Address Autocomplete with Bixby

The following video shows how to use the location-search sample capsule to autocomplete an address with this sample capsule.