KNSDK
INFO
This English reference is based on Directions SDK 1.12.8-hotfix02. For the latest version, see the Korean reference.
KNSDK provides three main features for using Kakao Navi: map, route, and guidance. These three features are separated into individual modules so that you can select and use only the features your service needs. For example, you can use the route module to check the estimated time of arrival (ETA), integrate the map module to display a route on the map, and integrate the guidance module to implement navigation.
Properties
| Name | Description | Type |
|---|---|---|
initSt | Authentication and initialization state | var initSt: KNSDKInitState |
delegate | The registered receiver | var delegate: KNSDKDelegate? |
Methods
install
Registers KNSDK in the Application class of the app to be used. An Android application has a single Application class, which you can use to declare classes or properties commonly used across the application.
fun install( application: Application,
rootPath: String? ): UnitParameters
| Name | Description |
|---|---|
application | The Application class of the app |
rootPath | The root path for managing KNSDK files |
sdkVersion
Returns the version of the KNSDK in use.
fun sdkVersion(): StringhandleWillResignActive
Notifies KNSDK when the application enters the paused state.
fun handleWillResignActive(): UnithandleDidEnterBackground
Notifies KNSDK when the application enters the background state.
fun handleDidEnterBackground(): UnithandleWillEnterForeground
Notifies KNSDK when the application enters the foreground state.
fun handleWillEnterForeground(): UnithandleDidBecomeActive
Notifies KNSDK when the application enters the resumed state. When the state is resumed, the paused state of voice guidance is released.
fun handleDidBecomeActive(): UnithandleWillTerminate
Notifies KNSDK when the application is terminated. If there is a route being driven at the time the application is terminated, its state value and route are saved.
fun handleWillTerminate(): UnithandleCarInterfaceConnected
Notifies KNSDK that the application has connected to an in-vehicle infotainment system.
fun handleCarInterfaceConnected(): UnithandleCarInterfaceDisconnected
Notifies KNSDK that the application has disconnected from the in-vehicle infotainment system.
fun handleCarInterfaceDisconnected(): UnitsetUserKey
Passes the key used to identify a user (UserKey) to KNSDK.
fun setUserKey( userKey: String? ): UnitParameters
| Name | Description |
|---|---|
userKey | The UserKey used to identify a user. The key value is issued by the service, and KNSDK uses it to identify individual users and provide personalized services. |
localDataWithUpdateVersion
Returns the downloaded map version and the latest map version received from the server when KNSDK is initialized.
fun localDataWithUpdateVersion(): Pair<Int Int>initializeWithAppKey
Initialize KNSDK.
TIP
You must initialize KNSDK before using it.
Example code — KNSDK
[KNSDK sharedInstance initializeWithAppKey:@"API Key" langType:KNLanguageType_KOREAN completion:^(KNError *error) {
if (error)
{
// SDK initialization failed
}
else
{
// SDK initialization succeeded
}
}];fun initializeWithAppKey( appKey: String,
clientVersion: String,
userKey: String? = null,
langType: KNLanguageType = KNLanguageType.KNLanguageType_KOREAN,
completion: ((error: KNError?) -> Unit)? ): UnitParameters
| Name | Description |
|---|---|
appKey | AppKey issued for use of KNSDK |
userKey | The UserKey used to identify a user. The key value is issued by the service, and KNSDK uses it to identify individual users and provide personalized services. |
langType | Language Settings |
completion | Callback that returns the initialization result |
makeRendererWithFrame
Request a map renderer. Internally we bind and initialize the loader, styler and renderer and then dispatch them.
fun makeRendererWithFrame( context: Context,
mapTheme: KNMapTheme,
width: Float = -1f,
height: Float = -1f,
surface: Surface ): KNMapControlManager?bindingMapView
Requests a map view object. Internally binds and initializes the loader, styler, and renderer, then returns it.
TIP
The map view object must be created through KNSDK.
fun bindingMapView( mapView: KNMapView,
mapTheme: KNMapTheme,
completion: ((KNError?) -> Unit)? ): Unit?makeTripWithStart
Creates KNTrip.
fun makeTripWithStart( start: KNPOI,
goal: KNPOI,
vias: MutableList<KNPOI>?,
csId: String? = null,
completion: (error: KNError? trip: KNTrip?) -> Unit ): UnitParameters
| Name | Description |
|---|---|
start | Origin |
goal | Destination |
vias | Waypoint list |
csId | CS-corresponding identifier. Currently not used. |
completion | Callback that returns the route |
sharedGuidance
Gets KNGuidance. Only one KNGuidance instance exists.
fun sharedGuidance(): KNGuidance?sharedGpsManager
Get KNGPSManager. Currently there is only one KNGPSManager.
fun sharedGpsManager(): KNGPSManager?reverseGeocodeWithPos
Returns the administrative address corresponding to KATEC coordinates. The returned value is returned in the following order: Error code, administrative code, province name, city/county/district name, and ward name, and is used in combination. Not all KATEC coordinates can be returned as an Address, and the null value can be returned as the intermediate value between the provincial name, city/county/district name, and district name.
fun reverseGeocodeWithPos( katecPos: IntPoint,
inUiThread: Boolean = true,
completion: ((error: KNError?,
addrCode: String?,
doName: String?,
siGunGuName: String?,
dongName: String?) -> Unit)? ): UnitParameters
| Name | Description |
|---|---|
katecPos | KATEC coordinates to be returned as Address |
inUiThread | Whether to return the result in UIThread state |
completion | Administrative building address corresponding to KATEC coordinates |
convertWGS84ToKATEC
Returns WGS84 coordinates converted to KATEC coordinates.
fun convertWGS84ToKATEC( wgs84Lon: Double,
wgs84Lat: Double ): FloatPointParameters
| Name | Description |
|---|---|
wgs84Lon | Longitude value in WGS84 coordinates |
wgs84Lat | Latitude value in WGS84 coordinates |
convertKATECToWGS84
Converts KATEC coordinates to WGS84 coordinates and returns them.
fun convertKATECToWGS84( katecX: Int,
katecY: Int ): DoublePointParameters
| Name | Description |
|---|---|
katecX | X value of KATEC coordinates |
katecY | Y value of KATEC coordinates |
requestLocationUpdate
Registers a receiver for location updates from KNGPSManager. Updates are delivered through the registered receiver.
fun requestLocationUpdate( delegate: KNGPSReceiver ): Unit?Parameters
| Name | Description |
|---|---|
delegate | Receiver to register |
removeLocationUpdate
Delete the receiver registered in KNGPSManager.
fun removeLocationUpdate( delegate: KNGPSReceiver ): Unit?Parameters
| Name | Description |
|---|---|
delegate | Registered Receiver |
reqPoiDetail
Queries and returns detailed information of a point of interest (POI).
fun reqPoiDetail( idList: List<String>,
completion: ((error: KNError?,
poiDetailResult: KNPoiDetailResult?) -> Unit)? ): Unit?Parameters
| Name | Description |
|---|---|
idList | List of Points of Interest (POI) IDs to retrieve detailed information |
completion | Return detailed information searched by point of interest (POI) ID. Return error on failure |
reqSearch
Searches for places that match a keyword. The keyword must use precomposed characters.
fun reqSearch( keyword: String,
pageNo: Int,
pageSize: Int,
request: KNSearchReqType,
x: Int,
y: Int,
completion: ((error: KNError?,
searchResult: KNSearchResult?) -> Unit)? ): Unit?Parameters
| Name | Description |
|---|---|
keyword | Search keyword using precomposed characters |
pageNo | Starting number of search results page |
pageSize | Number of search results per page |
request | Search Type |
x | X coordinate of current location for neighborhood priority search |
y | Y coordinate of current location for neighborhood priority search |
completion | Returns search results searched by search keyword. Return error on failure |
reqPoiSearchAround
Search for a point of interest (POI) by specifying a radius centered on the search coordinates. The facility type of the point of interest being searched changes depending on the category code.
fun reqPoiSearchAround( cCode: Int,
fuelType: KNCarFuel,
pos: FloatPoint,
mbr: MBR,
completion: ((error: KNError?,
poiSearchAroundResult: KNPoiSearchAroundResult?) -> Unit)? ): Unit?Parameters
| Name | Description |
|---|---|
cCode | category code to search |
fuelType | Fuel Type |
pos | Coordinates of current location for neighborhood priority search |
mbr | Coordinate area to search |
completion | Returns a list of points of interest (POIs) corresponding to the category code within the search coordinate area. Return error on failure |
swapMapDb
Switch between local maps and cloud maps.
fun swapMapDb( completion: ((KNError?) -> Unit)? ): UnitclearDBFile
Remove any downloaded or cloud map files.
fun clearDBFile( completion: ((KNError?) -> Unit)? ): UnitlocalMapDownload
Start downloading local maps.
fun localMapDownload( onDownloadStateListener: OnDownloadStateListener,
isAutoSwap: Boolean ): OnKNDownloadCommandListener?Parameters
| Name | Description |
|---|---|
onDownloadStateListener | Returns the download status of the map file |
isAutoSwap | Whether to automatically switch the map database (DB) to the local map when download is complete |
sharedConnection
Get KNConnection. Currently there is only one KNConnection.
fun sharedConnection(): KNConnection?setPOIRatio
Sets a scale to adjust the size of points of interest (POI). (min: 0.5, max: 2.0)
fun setPOIRatio( ratio: Float )setBuildingFlat
Sets whether buildings are displayed flat on the map. (default: false)
fun setBuildingFlat( isBuildingFlat: Boolean )KNSDKRelease
KNSDKReleases.
fun KNSDKRelease()setAppUserId
Sets appUserId to identify the user.
fun setAppUserId( AppUserId: String? )Parameters
| Name | Description |
|---|---|
AppUserId | User identification value |