Uh oh! We couldn’t find any match.

Please try other search keywords.

Bixby Developer Center

Guides

Navigation (viv.navigation)

The Bixby viv.navigation library capsule enables your capsule to launch Google Maps with a provided destination for turn-by-turn directions.

Models

The models you work with in viv.navigate are primitive concepts:

  • Destination: a geo.NamedPoint specifying the destination.

  • Origin: a geo.NamedPoint specifying the origin. If an Origin is not provided, Bixby will assume the origin is the user's current location.

  • Navigate: The model output by the NavigatePunchout action. This is matched by a view in viv.navigation which contains an app-launch to launch Google Maps.

  • TravelMode: an optional enum that specifies the user's desired method of travel. Its symbols are:

    • Driving
    • Walking
    • Bicycling
    • Transit

Usage

In your capsule, create a concept that takes on the role-of the Navigate concept:

structure (Navigate) {
role-of (navigation.Navigate)
}

Then, create a constructor action that outputs a navigation.Destination object, which has the role-of geo.NamedPoint. For instance, imagine your capsule has a Business structure, which includes the following properties (it may have others):

PropertyTypeKindNotes
nameBusinessNametext
addressgeo.Addressstructure 

So, your action will be:

action (ConstructDestination) {
type (Constructor)
description (Make a NamedPoint from a Business.)
collect {
input (business) {
type (Business)
min (Required) max (One)
}
}
output (navigation.Destination)
}

Accessing the centroid property of geo.Address generates a geo.GeoPoint for the associated address using geocoding; together with BusinessName, your JavaScript action implementation should return a NamedPoint:

module.exports.function = function constructDestination (business) {
var businessGeoPoint = business.address.centroid;

return {
name: business.name,
address: business.address,
point: {
latitude: businessGeoPoint.latitude,
longitude: businessGeoPoint.longitude,
}
}
}

The name key is optional. If provided, the naem will be sent to Google Maps as well.

Training

To use viv.navigation, you'll need to train your capsule's utterances to the goal Navigate.

[g:Navigate] Get me directions to (Hanabi Sushi)[v:BusinessName]

Also, supply your capsule with a dialog for the outer query:

dialog (Selection) {
match: Business {
to-input: ConstructDestination
}
template("Which one do you want to go to?")
}

Using the previous Business example, the utterance "get me directions to Hanabi Sushi" will show a list of businesses that match the supplied name "Hanabi Sushi", let the user select the correct one, and then punch out to Google Maps to navigate to the selected business.

A continuation needs a Flag of Route to your Constructor function. In our example, this would be r:ConstructDestination:

[g:Navigate:continue:Business,r:ConstructDestination] Navigate there

Here are some suggested phrases to train as a continuation.

  • "Navigate"
  • "Navigate there"
  • "Take me there"
  • "Get me directions there"

Origin and TravelMode

You can provide an optional Origin address to your actions; when passed to Google Maps, navigation will start from the NamedPoint specified in Origin. In many cases, though, you won't need to provide this; Bixby will start navigation from the user's current location.

Note

While you are able to train TravelMode values, currently viv.navigation ignores travel modes when planning.

If you'd like to offer the user different methods of transportation, you can include values for TravelMode as part of the training:

[g:Navigate] Get me (walking)[v:navigation.TravelMode:Walking] directions to (Hanabi Sushi)[v:BusinessName]