Waypoints
Use NaviHelper APIs 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.
- Kotlin
- Java
// 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()
// Set destination
naviHelper.requestRoute(new RouteInfo(
127.03636666,
37.48544722,
null,
null,
"42dot",
"36khp37hh8gqcm5nqhe5",
"서울시 강남구 남부순환로 2621",
"0",
RouteOption.RECOMMENDED
));
// Add waypoint
naviHelper.addWaypoint(new RequestWaypointInfo(
127.09481944,
37.41275833,
"소프트웨어드림센터",
WaypointIndex.FIRST,
"36khp2hdj2cfcm5nqhe3",
"경기도 성남시 수정구 창업로40번길 6",
"0"
));
// Receive data in the onWaypointInfo callback
@Override
public void onWayPointInfo(List<WaypointInfo> list) {
Log.d(logTag, "onWayPointInfo = " + list);
}
// 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.