Skip to content

Voice controller nav intent

For Voice to control Nav for map display, get directions, POI search, etc., VIA will send out Android standard Intent for Nav to consume to rendering page accordingly. Below is the Intent Nav side should handle or send out to fulfill Nav end to end integration behavior.

Update current location info from Nav to Voice Assistant

  • Action: UPDATE_DOMAIN_CONTEXT_ACTION
  • Bundle Fields:
Key Value ValueType
"updated_fields" "location" string
"context" "location": {"type": "coordinate","description": "CVP Location"} Json string
  • Code Example:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
val domain = "UDE"

val intentAction = com.telenav.assistant.GET_DOMAIN_CONTEXT_ACTION

val assistantIntent = Intent(intentAction)
assistantIntent.putExtra("domain", domain)
assistantIntent.putExtra("request_id", requestId)
assistantIntent.putExtra("source", source)  
assistantIntent.putExtra("updated_fields", "location")
assistantIntent.putExtra("context", context)               
assistantIntent.putExtra("updated_fields", updated_fields)

context.sendBroadcast(assistantIntent)

Show Search Results on Nav App

Alt text

  • Action: com.telenav.apps.maps.SHOW_SEARCH_RESULTS
  • Bundle Fields:
Key Value ValueType
search_result see Entity Data Model Json Array
query "gas stations" String
radius 5000 int, unit: m
location 31.1234, - 121.1111 Geo location
brand "Mod Pizza" String
sort best_match/distance/price String enum
  • Code example of how Voice Assistant send out the Intent:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
var location = search_request.location

val geo = URLEncoder.encode("geo:${location.latitudeInDegrees}, ${location.longitudeInDegrees}","utf-8")
val intentAction = "com.telenav.apps.maps.SHOW_SEARCH_RESULTS"
val mapIntent = Intent(intentAction)
mapIntent.putExtra("api", 1)
mapIntent.putExtra("original_domain", "UDE")
mapIntent.putExtra("source", "voice")
mapIntent.putExtra("request_id", requestID)
mapIntent.putExtra("radius", radius)
mapIntent.putExtra("location", geo)
mapIntent.putExtra("query", query)
mapIntent.putExtra("search_result", searchResults.toString())
mapIntent.putExtra("brand", brand.toString()) // optional, for ICC case now

context.sendBroadcast(mapIntent)
  • Code example of how Nav send back response to continue the dialog:
1
2
3
4
5
6
7
8
9
  action=com.telenav.apps.maps.NAV_API_RESULT
  {  

      "action_path" : "nav/search/show",
      "request_Id" : "request id, provided",
      "original_domain" : "UDE",    
      "source" : "voice",              
      "status_code": 0
  }

Note

Please make sure original_domain filled by the one in request. default is UDE, could be ignored.

Start Navigation from Nav app

  • Action: com.telenav.apps.maps.START_DIRECTIONS
  • Bundle Fields:
Key Value ValueType
"destination" "see Entity Data Model" Json object
  • Code Example of how Voice Assistant send out the Intent:
1
2
3
4
5
6
7
8
9
val intentAction = "com.telenav.apps.maps.START_DIRECTIONS"
val mapIntent = Intent(intentAction)
mapIntent.putExtra("api", 1)
mapIntent.putExtra("original_domain", "UDE")
mapIntent.putExtra("source", "voice")
mapIntent.putExtra("request_id", requestID)
mapIntent.putExtra("type", "entity")
mapIntent.putExtra("destination", destination)
context.sendBroadcast(mapIntent)
  • Code Example of how Nav send back response to continue the dialog:

Note

Please make sure original_domain filled by the one in request. default is UDE, could be ignored.

1
2
3
4
5
6
7
8
action=com.telenav.apps.maps.NAV_API_RESULT
{
"action_path" : "/nav/direction/start",
"request_Id" : "request id, provided",
"original_domain" : "UDE",
"source" : "voice",
"status_code": 0
}

Add Waypoint from Nav app

  • Action: com.telenav.apps.maps.ADD_WAYPOINT
  • Bundle Fields:
Key Value ValueType
waypoint "see Entity Data Model" Json object
  • Code Example of how Voice Assistant send out the Intent:
1
2
3
4
5
6
7
8
9
val intentAction = "com.telenav.apps.maps.ADD_WAYPOINT"
val mapIntent = Intent(intentAction)
mapIntent.putExtra("api", 1)
mapIntent.putExtra("original_domain", "UDE") mapIntent.putExtra("source", "voice")
mapIntent.putExtra("request_id", requestID)
mapIntent.putExtra("type", "entity")
mapIntent.putExtra("waypoint", waypoint)

context.sendBroadcast(mapIntent)
  • Code Example of how Nav send back response to continue the dialog:
1
2
3
4
5
6
7
8
action=com.telenav.apps.maps.NAV_API_RESULT
{
    "action_path" : "/nav/direction/addwaypoint",
    "request_Id" : "request id, provided",
    "original_domain" : "UDE",
    "source": "voice",
    "status_code": 0
}

Cancel Navigation on Nav app

  • Action: com.telenav.apps.maps.CANCEL_DIRECTIONS
  • Bundle Fields: No specific fields, action is enough

  • Code Example of how Voice Assistant send out the Intent:

1
2
3
4
5
6
7
val intentAction = "com.telenav.apps.maps.CANCEL_DIRECTIONS"
val mapIntent = Intent(intentAction)
mapIntent.putExtra("api", 1)
mapIntent.putExtra("source", "voice")
mapIntent.putExtra("request_id", requestID)

context.sendBroadcast(mapIntent)
  • Code Example of how Nav send back response to continue the dialog:
1
2
3
4
5
6
7
action=com.telenav.apps.maps.NAV_API_RESULT
{
"action_path" : "/nav/direction/stop",
"request_Id" : "request id, provided",
"source": "voice",
"status_code": 0
}

Voice search content from Nav app(happen in embedded mode only)

  • Action: com.telenav.apps.maps.ONE_BOX_SEARCH
  • Bundle Fields:
Key Value ValueType
query "gas stations" String
radius 5000 int, unit: m
location 31.1234, - 121.1111 Geo location
brand "Mod Pizza" String
sort best_match/distance/price String enum
  • Code Example of how Voice Assistant send out the Intent:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
val location = search_request.location
val geo = URLEncoder.encode("geo:${location.latitudeInDegrees}, ${location.longitudeInDegrees}","utf-8")
val intentAction = "com.telenav.apps.maps.ONE_BOX_SEARCH"
val mapIntent = Intent(intentAction)
mapIntent.putExtra("api", 1)
mapIntent.putExtra("original_domain", "UDE")
mapIntent.putExtra("source", "voice")
mapIntent.putExtra("request_id", requestID)
mapIntent.putExtra("radius", radius)
mapIntent.putExtra("location", geo)
mapIntent.putExtra("query", query)
mapIntent.putExtra("brand", brand.toString()) // optional, for ICC case now

context.sendBroadcast(mapIntent)
  • Code Example of how Nav send back response to continue the dialog:
1
2
3
4
5
6
7
8
action=com.telenav.apps.maps.NAV_API_RESULT
{
"action_path" : "/nav/search/find",
"request_Id" : "request id, provided",
"status_code": 0,
"source" : "cloud | on-board",
"search_results" : ["list of search entities"]
}

To ensure Voice Assistant could handle Nav commands base on latest context(IGV/AGV, along route points for search along, destination for search near destination, etc.), it is required that Nav app could always send this Intent out whenever there is Nav state change(Guidance started/Stopped/arrived, Waypoint added/removed/arrived).

  • Action: com.telenav.apps.maps.NAV_CONTEXT_UPDATE
  • Bundle Fields:
Key Value ValueType
waypoint see Navigation Context Data Model Json object
  • Code Example of how Nav send out the Intent:
1
2
3
4
5
6
7
8
val intentAction = "com.telenav.apps.maps.NAV_CONTEXT_UPDATE"
val mapIntent = Intent(intentAction)
mapIntent.putExtra("api", 1)
mapIntent.putExtra("source", "app")
mapIntent.putExtra("source", "voice")
mapIntent.putExtra("navigation_context", navigationContext)

context.sendBroadcast(mapIntent)