Skip to main content

Waypoints

This guide explains how to add, retrieve, and remove waypoints. Confirm the results in NaviHelperEventListener callbacks.

Add and remove waypoints​

You can specify up to two waypoints, distinguished by WaypointIndex.FIRST and WaypointIndex.SECOND. Call addWaypoint() to add a waypoint and removeWaypoint() to remove it.

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

// Add waypoint
naviHelper.addWaypoint(
RequestWaypointInfo(
latitude = 37.41275833,
longitude = 127.09481944,
waypointIndex = WaypointIndex.FIRST,
poiId = "36khp2hdj2cfcm5nqhe3",
poiName = "소프트웨어드림센터",
poiSubId = "0",
address = "경기도 성남시 수정구 창업로40번길 6"
)
)

// Receive data in the onWaypointInfo callback
override fun onWaypointInfo(waypointInfo: List<WaypointInfo>) {
Log.d(logTag, "onWaypointInfo $waypointInfo")
}

// Remove waypoint
naviHelper.removeWaypoint(WaypointIndex.FIRST)

// Cancel destination
naviHelper.cancelRoute()

Call getWaypointInfo() to request the current waypoint list. The result is delivered to onWayPointInfo(). To remove all waypoints, use removeWaypoint(WaypointIndex.ALL).

naviHelper.getWaypointInfo()

// Remove all waypoints
naviHelper.removeWaypoint(WaypointIndex.ALL)

onWayPointInfo() may be called when waypoint information is retrieved. onWayPointArrived() may be called when the vehicle arrives at a waypoint.