Skip to main content

Routes

Use NaviHelper APIs to change the route option and request rerouting. Confirm the results in NaviHelperEventListener callbacks. For setting a destination, see Destinations.

Change the route option

RouteOption provides the following values.

ValueDescription
RECOMMENDEDRecommended route
SHORT_DISTANCEShortest-distance route
SHORT_TIMEShortest-time route
FREEFree-road-priority route
HIGHWAYHighway-priority route
COMFORTABLEComfortable route
SCHOOL_ZONESchool-zone-aware route

You can set the option in RouteInfo.routeOption when first setting the destination, or change it during guidance with changeRouteOption().

// Set destination
naviHelper.requestRoute(
RouteInfo(
latitude = 37.48544722,
longitude = 127.03636666,
displayLongitude = null,
displayLatitude = null,
poiName = "42dot",
poiId = "36khp37hh8gqcm5nqhe5",
poiSubId = "0",
address = "서울시 강남구 남부순환로 2621"
)
)

// Change route option to highway priority
naviHelper.changeRouteOption(RouteOption.HIGHWAY)

// Receive the changed data in the onRouteOptionChanged callback
override fun onRouteOptionChanged(routeOption: RouteOption) {
Log.d(logTag, "onRouteOptionChanged $routeOption")
}

// Cancel destination
naviHelper.cancelRoute()

Request rerouting

Call requestReRoute() to request a route recalculation based on the current location and destination.

// Set destination
naviHelper.requestRoute(
RouteInfo(
latitude = 37.48544722,
longitude = 127.03636666,
displayLongitude = null,
displayLatitude = null,
poiName = "42dot",
poiId = "36khp37hh8gqcm5nqhe5",
poiSubId = "0",
address = "서울시 강남구 남부순환로 2621"
)
)

// Request rerouting
naviHelper.requestReRoute()

// Cancel destination
naviHelper.cancelRoute()
note

Request route option changes and rerouting only when an active route exists. The processing result and callbacks that are actually delivered may vary depending on the Navigation app state.