KNTrip
INFO
This English reference is based on Directions SDK with UI 1.12.8-hotfix02 (as of 2026-07-24). For the latest version, see the Korean reference.
A class that manages routes. It takes the location information of the origin, destination, and waypoints as input and provides routes by option. You can also check information such as distance, fee, and time for the selected route.
TIP
- The KNTrip class must be created through KNSDK.
- It works with KNGuidance to run route guidance and manage driving information.
Example code — KNTrip
class KNTrip : KNTrip_GuidanceExtension, KNSerializableConstructor
Example code — Initialization
// <init>
KNTrip()
KNTrip(start: KNPOI, goal: KNPOI, vias: MutableList<KNPOI>?, csId: String?, transId: String)Properties
| Name | Description | Type |
|---|---|---|
start | Origin location information | var start: KNPOI |
goal | Destination location information | var goal: KNPOI |
vias | Waypoint location information | var vias: MutableList<KNPOI>? |
routeConfig | Route configuration information | var routeConfig: KNRouteConfiguration |
useMultiRoute | Whether to use multi-route. true : use multi-route, false : do not use multi-route (default: true ) | var useMultiRoute: Boolean |
Methods
addVia
Adds a waypoint.
fun addVia(via: KNPOI, location: KNLocation): UnitParameters
| Name | Description |
|---|---|
via | Waypoint location information (POI) |
location | Location at which to add the waypoint |
addVia
Adds a waypoint.
fun addVia(via: KNPOI, idx: Int): UnitParameters
| Name | Description |
|---|---|
via | Waypoint location information |
idx | Waypoint order (index). The order is assigned according to the visiting order of the waypoints; a lower index is the waypoint visited first. If the index is larger than the number of registered waypoints, it is treated as the last waypoint. |
elapsedCost
Returns the driving fee to the destination (unit: KRW).
fun elapsedCost(): IntelapsedDist
Returns the driving distance to the destination (unit: m).
fun elapsedDist(): IntelapsedTime
Returns the driving time to the destination (unit: seconds).
fun elapsedTime(): IntpassedVias
Returns the list of waypoints that have been driven through in the route.
fun passedVias(): List<KNPOI>?remainCost
Returns the remaining fee to the destination based on the current location (unit: KRW).
fun remainCost(): IntremainDist
Returns the remaining distance to the destination (unit: m).
fun remainDist(): IntremainTime
Returns the remaining time to the destination (unit: seconds).
fun remainTime(): IntremoveAllVias
Removes all waypoints.
fun removeAllVias(): UnitremoveViaAtIdx
Removes a specific waypoint.
fun removeViaAtIdx(idx: Int): UnitParameters
| Name | Description |
|---|---|
idx | Waypoint order (index). The order is assigned according to the visiting order of the waypoints; a lower index is the waypoint visited first. If the index is larger than the number of registered waypoints, it is treated as the last waypoint. |
routeWithPriority
Requests a route. The requested route is delivered asynchronously.
fun routeWithPriority(priority: KNRoutePriority, avoidOptions: Int, completion: ((KNError?, MutableList<KNRoute>?) -> Unit)?): UnitParameters
| Name | Description |
|---|---|
priority | Item to prioritize during route guidance |
avoidOptions | Sections to exclude from the route. Up to two routes can be entered. The main route and the alternative route are entered in order, and the alternative route can be omitted. |
completion | Delivers the requested route |
setRouteConfig
Reconfigures the route by reflecting changed information when information such as vehicle type, whether a Hi-pass device is installed, or traffic incident information changes.
fun setRouteConfig(routeConfig: KNRouteConfiguration?): UnitParameters
| Name | Description |
|---|---|
routeConfig | Vehicle information |
setVias
Sets waypoints in bulk.
fun setVias(vias: List<KNPOI>?): UnitParameters
| Name | Description |
|---|---|
vias | List of waypoint location information |