Hands-on Guide 5 — Integrating the Kakao Navi SDK on Android: Initialization, 17 Callbacks, and Pulling Out Speeding Data

Pitfalls hit while attaching KNSDK to an Android app: the black screen you get when creating the view before authentication, 17 guidance callbacks you have to forward by hand, how to read Kakao's speeding judgment without lag, and the difference between BLE speed and GPS speed.

Reporting notebook showing guidance callbacks being wired one by one into the Kakao Navi screen, with one strand left unplugged

Building a Non-Developer's AI Office Hands-on Guide 5. This is the process of actually attaching the Kakao navigation SDK (KNSDK), set up in Hands-on Guide 4, to an Android app. It focuses on pitfalls you can't learn from the official samples alone — places that die quietly without any error. Reference version: knsdk_ui 1.12.8-hotfix03.

What to Watch For 👀

  • Create the navigation view before authentication finishes and you get a black screen with no exception and no log
  • The assumption was that the navigation view receives guidance on its own. It doesn't. You have to forward 17 callbacks by hand. Miss one and only that feature quietly dies
  • How to pull out Kakao's "speeding right now" value — and why that value changed late
  • Car speed (BLE) and Kakao speed (GPS) are different. Underground, Kakao's speed drops to 0

1. Dependencies — Three Repositories, One Library

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google(); mavenCentral()
        maven("https://devrepo.kakaomobility.com/repository/kakao-mobility-android-knsdk-public/")
        maven("https://devrepo.kakaomobility.com/repository/kakao-mobility-android-locationsdk-release/")
        maven("https://devrepo.kakaomobility.com/repository/kakao-mobility-android-knsdk-release/")
    }
}

// navi-kakao/build.gradle.kts
dependencies {
    implementation("com.kakaomobility.knsdk:knsdk_ui:1.12.8-hotfix03")
    implementation("androidx.constraintlayout:constraintlayout:2.1.4") // needed by KNNaviView
}
  • SNAPSHOT versions are development builds — don't use them
  • 🔴 This app confines KNSDK to a separate module (navi-kakao). The main app never sees Kakao types directly and receives only standard events. Swap or remove the navigation provider and the app still builds

2. Initialization — Create the View After Authentication Finishes

// 1) Install (main thread)
KNSDK.install(application, "${filesDir}/knsdk")

// 2) Authenticate — wait for the completion callback
KNSDK.initializeWithAppKey(
    appKey,            // native app key (injected from local.properties → BuildConfig)
    "1.0",             // app version
    userKey,           // 🔴 no personal data — a random per-device UUID
    "KOR",
    KNLanguageType.KNLanguageType_KOREAN,
) { error ->
    if (error == null) { /* 3) create KNNaviView in code here and attach it */ }
}
PitfallSymptomFix
Creating KNNaviView before authentication (e.g., putting it in layout XML)Black screen. No exception, no logKeep only an empty container and create the view in code after authentication succeeds (the same approach as Kakao Mobility tech support's answer)
Calling initialization from two placesBreaks quietly (KNSDK is one per process)Manage initialization state in one place only (singleton + lock), safe to call repeatedly
Waiting forever for authenticationThe screen stays empty foreverSet a time limit (15 seconds in this app) and show the failure on screen
Empty app keyPointless network round tripsIf the key is empty, don't call the SDK; fail immediately

3. The Biggest Pitfall — Forwarding 17 Guidance Callbacks by Hand

At first it wasn't clear why the Activity in the official sample implements as many as six callback interfaces. Opening the SDK revealed the reason.

  • KNNaviView does not implement the guidance callback interfaces. It merely has methods with the same names. So you can't just pass the view in, as in guidance.guideStateDelegate = naviView
  • Nobody wires up the six callback types of the guidance engine (KNGuidance) automatically. The app registers them and must forward each callback received to naviView.guidanceXXX(...) one by one
// Structure example — gather it all in one relay class
override fun guidanceDidUpdateLocation(guidance, locationGuide) {
    naviView.guidanceDidUpdateLocation(guidance, locationGuide)   // forward as is
    // if needed, pull values out here and send them to our dashboard
}
// … all 17 like this
If you missSymptomError
Location callbackThe map doesn't follow the carNone
Route guidance callbackTurn and lane guidance stopNone
Safe-driving callbackSpeed camera warnings don't appearNone
Voice callbackNo voice guidanceNone

There are finer pitfalls too.

  • Two with different signatures: for route change (guidanceRouteChanged), the interface takes 6 arguments while the view takes only 1. For guidance end (guidanceGuideEnded), the view side takes 2 arguments (with a default). The other 15 are forwarded exactly as received
  • List types: only the voice data list is a mutable list (MutableList); the rest are read-only. Make them "consistent" and compilation breaks
  • Threads: callbacks arrive on Kakao's thread. Even so, don't wrap the view calls onto another thread — the order gets shuffled and guidance jumps. Hand off only your own screen updates via Flow
  • No logging: they arrive several times a second, and location and routes are personal data

4. Pulling Out Data — Syncing Speeding Warnings with Kakao

Hand drawing of the structure that syncs Kakao's speed camera judgment and the gauge's speeding warning every time the location changes

A speeding warning (red flashing) was added to the dashboard gauge. During guidance Kakao sends speed camera info, which includes speedLimit (speed limit) and onViolation (in violation right now). But replaying real-car records showed stretches where the flashing persisted even after slowing down (64 seconds in a simulated drive home).

Opening the SDK revealed the cause.

WhatKakao's internal rule
Violation judgment onViolationGPS speed > speed limit (no margin). Recalculated every time the GPS position updates and written directly into the camera object
Voice warningWhile in violation, speed > limit × (1 + margin), and under 500 m to the camera. The margin is default / 5% / 10%

Our app was reading onViolation only when the camera list changed. Kakao updates that value inside the object every time the location changes. So while the list stayed the same, our value was frozen.

The fix: hold on to the current camera object in the list callback, and every time a location callback arrives, re-read that object's onViolation · speedLimit · passed and push them to the dashboard only when they change. Now the flashing turns on and off in step with the red violation indicator on Kakao's screen.

5. Car Speed and Kakao Speed Are Different

Car (BLE) speed_floatKakao GPS speed
SourceWheel speedTablet GPS
Underground · tunnels✅ Normal❌ 0 or frozen (confirmed in the real car)
This app's gaugeUses this valueDoesn't use it

Gauge numbers from car speed, speeding judgment from Kakao's values. Splitting the roles keeps the gauge moving even underground.

6. Other Values You Can Use Right Away

  • Colored road guide lines: turn guidance includes lane colors (pink · green · light green · sky blue) (getLaneColor)
  • Highway info: a list of nearby interchanges · junctions · toll gates · rest areas, plus junction guidance images (bitmaps)
  • Arrival: Kakao sends the end callback a little late after it stops guidance. Account for this in screen transitions right after arrival

Summary

  • Three repositories + one knsdk_ui. Confine it to a separate module
  • Authentication complete → then create the view. Break the order and you get a black screen
  • Relay all 17 callbacks. Leave any empty and the feature disappears without an error
  • Re-read values not "when the list changes" but "when the location changes"

How all of this actually looks inside the car continues in the main series. The earlier Tesla-side connection is in Hands-on Guide 2 and Hands-on Guide 3.

※ The SDK's internal behavior is based on checking public class signatures with javap and may differ by version. No internal code was copied.