KNNaviView
INFO
This English reference is based on Directions SDK 1.12.8-hotfix02. For the latest version, see the Korean reference.
A class that composes the basic guidance screen. When you need a driving guidance screen outside of the Kakao Navi service, you can compose the guidance screen using the minimum elements required for driving guidance. It consists of sub-elements such as MapView, DirectionView, and MenuView. When initializing KNNaviView, you can set information used in the user interface, such as sndVolume and useDarkMode.
TIP
However, the entered information values are not saved separately, and the default values from when KNNaviView is created are used.
For sndVolume, you can receive the changed value (0 to 1.0f) through a callback when the route guidance volume is set in the app.
Example code — KNNaviView
KNNaviView(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)Properties
| Name | Description | Type |
|---|---|---|
stateDelegate | Delegate that represents the KNNaviView state | var stateDelegate: KNNaviView_StateDelegate? |
guideStateDelegate | Delegate that represents the guide state of KNNaviView | var guideStateDelegate: KNNaviView_GuideStateDelegate? |
mapComponent | Displays the 3D vector map | val mapComponent: KNComponentMapView |
curDirComponent | Displays the first route guidance (RG: Route Guidance) information | val curDirComponent: KNComponentCurDirectionView |
nextDirComponent | Displays the second route guidance (RG: Route Guidance) information | val nextDirComponent: KNComponentNextDirectionView |
useDarkMode | Whether to use night mode | var useDarkMode: Boolean |
carType | Vehicle type | var carType: KNCarType |
fuelType | Vehicle fuel | var fuelType: KNCarFuel |
sndVolume | Voice Volume (Range: 0~1f) | var sndVolume: Float |
statusbarHeight | Height value of the status bar | var statusbarHeight: Int |
viewState | State of the basic driving guidance screen | var viewState: KNNaviViewState |
mapViewMode | Camera mode currently used on the map | var mapViewMode: MapViewCameraMode |
useJcImg | Sets whether to display the intersection image | var useJcImg: Boolean |
mapDriveScale | Sets the screen scale of the driving map (far, default, near view) | var mapDriveScale: KNMapDriveScale |
Methods
initWithGuidance
Starts route guidance through the basic driving screen.
fun initWithGuidance( guidance: KNGuidance,
trip: KNTrip?,
routePriority: KNRoutePriority,
avoidOptions: Int ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
trip | Route to use for driving |
routePriority | Items to prioritize when choosing a route during route guidance |
avoidOptions | Sections to avoid in the route |
changeDisplayType
Changes the map theme (mapTheme) of the mapComponent that displays the 3D vector map.
fun changeDisplayType( displayType: KNDisplayType ): UnitguidanceGuideStarted
Directions will begin. guidanceGuideStated() of KNNaviView called by the guidance status delegate (guideStateDelegate) of KNGuidance
fun guidanceGuideStarted( guidance: KNGuidance ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
guidanceCheckingRouteChange
Detects a change in the route. Called when the route is recalculated due to traffic changes or route deviation, or when the user reroutes. Delivers the content of guidanceCheckingRouteChange(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceCheckingRouteChange( guidance: KNGuidance ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
guidanceRouteUnchanged
Keeps the existing route. Called when there is no route change after detecting a traffic change, or when the newly requested route due to a traffic condition change is identical to the existing route. Delivers the content of guidanceRouteUnchanged(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceRouteUnchanged( guidance: KNGuidance ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
guidanceRouteUnchangedWithError
Returns an error message when a route request fails. Delivers the content of guidanceRouteUnchangedWithError(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceRouteUnchangedWithError( guidance: KNGuidance,
error: KNError ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
error | Route request failure error |
guidanceOutOfRoute
Deviates from the existing route. Delivers the content of guidanceOutOfRoute(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceOutOfRoute( guidance: KNGuidance ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
guidanceRouteChanged
Delivers a route change. Among multiple routes, the first route is the driving route and the rest become alternative routes. Delivers the content of guidanceRouteChanged(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceRouteChanged( guidance: KNGuidance ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
guidanceGuideEnded
Ends route guidance. Delivers the content of guidanceGuideEnded(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView. You can also set whether to display a popup message indicating the end of route guidance.
fun guidanceGuideEnded( guidance: KNGuidance,
isShowDriveResultDialog: Boolean )Parameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
isShowDriveResultDialog | Whether to display the route guidance end popup message (default: true ) |
guidanceDidUpdateRoutes
Changes the existing routes. Delivers the content of guidanceDidUpdateRoutes(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceDidUpdateRoutes( guidance: KNGuidance,
routes: List<KNRoute>,
multiRouteInfo: KNMultiRouteInfo? ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
routes | List of route information |
multiRouteInfo | Alternative route information |
guidanceDidUpdateLocation
Updates the location information. Delivers the content of guidanceDidUpdateLocation(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceDidUpdateLocation( guidance: KNGuidance,
locationGuide: KNGuide_Location ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
locationGuide | Location information |
guidanceDidUpdateRouteGuide
Delivered when one or more of the detailed items of the route guidance information change. Delivers the content of guidanceDidUpdateRouteGuide(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceDidUpdateRouteGuide( guidance: KNGuidance,
routeGuide: KNGuide_Route ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
routeGuide | Route guidance information |
guidanceDidUpdateSafetyGuide
Delivered when one or more of the detailed items of the safe driving guidance information change. Delivers the content of guidanceDidUpdateSafetyGuide(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceDidUpdateSafetyGuide( guidance: KNGuidance,
safetyGuide: KNGuide_Safety? ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
safetyGuide | Safe driving guidance information |
guidanceDidUpdateAroundSafeties
Delivers surrounding safe driving information data. Delivers the content of guidanceDidUpdateAroundSafeties(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun guidanceDidUpdateAroundSafeties( guidance: KNGuidance,
safeties: List<KNSafety>? ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
safeties | List of safe driving information |
shouldPlayVoiceGuide
Returns whether to play voice guidance. If false is returned, voice guidance is not played. Delivers the content of shouldPlayVoiceGuide(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
TIP
Voice guidance is not stopped when switching to background mode during route guidance.
fun shouldPlayVoiceGuide( guidance: KNGuidance,
voiceGuide: KNGuide_Voice,
newData: MutableList<ByteArray> ): BooleanParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
voiceGuide | Voice guidance information |
newData | List of new voice data to replace the existing voice |
willPlayVoiceGuide
Plays voice guidance. Delivers the content of willPlayVoiceGuide(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun willPlayVoiceGuide( guidance: KNGuidance,
voiceGuide: KNGuide_Voice ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
voiceGuide | Voice guidance information |
didFinishPlayVoiceGuide
Ends voice guidance. Delivers the content of didFinishPlayVoiceGuide(), called by the guidance state delegate (guideStateDelegate) of KNGuidance, to KNNaviView.
fun didFinishPlayVoiceGuide( guidance: KNGuidance,
voiceGuide: KNGuide_Voice ): UnitParameters
| Name | Description |
|---|---|
guidance | Route guidance feature and route information |
voiceGuide | Voice guidance information |
guideNewDestinations
Ends safe driving mode and starts new route guidance.
fun guideNewDestinations( trip: KNTrip,
priority: KNRoutePriority?,
avoidOption: Int? )Parameters
| Name | Description |
|---|---|
trip | Route to guide |
priority | Route search priority option |
avoidOption | Route search restriction option |
guideCancel
Ends route guidance and switches to safe driving mode.
fun guideCancel()