페이지 이동경로
  • Docs>
  • Kakao Navi>
  • Android

Kakao Navi

Android

This document describes how to integrate the Kakao Navi API into your service with the Kakao SDK for Android (hereinafter referred to as 'Android SDK').

Before you begin

Register Android Platform

To use the Android SDK, you must register the Android platform in advance. Go to [My Application] > [Platform] and register the Android platform by specifying its package name and key hashes. If not, an error may occur.

Add modules

To use the features of Kakao Navi, you need to add v2-navi (Kakao Navi module) that provides NaviClient to the module-level build.gradle file by referring to Add modules. Since the ReactiveX Android SDK does not provide the Kakao Navi API, you must use the Kakao Navi module that the Android SDK provides.

Checking if Kakao Navi is installed

The Kakao Navi API provides the navigateIntent() function for navigation and the shareDestinationIntent() function for location sharing.

navigateIntent() and shareDestinationIntent() return Intent to invoke the navigation and location sharing function via the Kakao Navi app (hereinafter referred to as 'app') . If the Kakao Navi app is installed on a user's device, the app is launched. If not, the user is directed to the download page for the Kakao Navi app via the default web browser.

To check if the Kakao Navi app is installed on a user's device, use the isKakaoNaviInstalled() API. Here is an example to check if the Kakao Navi app is installed.

if (NaviClient.instance.isKakaoNaviInstalled(context)) {
    Log.i(TAG, "Possible to use navigation on Kakao Navi app.")
} else {
    Log.i(TAG, "Kakao Navi app is not installed.")
}

Set parameters

When you call the Kakao Navi API, pass the Location object containing destination information and the NaviOption object where search criteria is defined by specifying the following parameters.

Location

Name Type Description
name String Location name.
Example: "My Home", "Company"
rpFlag String Destination link.
Currently not supported.
x Number Longitude coordinate.
y Number Latitude coordinate.

NaviOption

Name Type Description
coordType CoordType Coordinate system to use.
vehicleType VehicleType Vehicle type.
rpOption RpOption Criteria to optimize routes.
routeInfo Boolean Whether to view entire route information to the destination.
startX Double Longitude coordinate of the starting point.

NOTE: This value is only used for a reference to get directions.
For navigation, the current position is used as a starting point regardless of the designated starting point.
startY Double Latitude coordinate of the starting point.

NOTE: This value is only used for a reference to get directions.
For navigation, the current position is used as a starting point regardless of the designated starting point.
startAngle Int Angle of the vehicle at starting point.
A value between 0 and 359.

NOTE: This value is only used for a reference to get directions.
For navigation, the current position is used as a starting point regardless of the designated starting point.
returnUri String URI to be redirected when stopping navigation (viewing entire routes).

You can optionally set the components of NaviOption. However, make sure to specify important search criteria. If not, Kakao Navi cannot find places and directions according to the set criteria.


You must set one of the predefined keys of the following Enum class for each component.

Enum: CoordType
Name Description
WGS84 World Geodetic System 84 coordinate system.
KATEC Katec coordinate system.
This is set as a default.

Enum: VehicleType
Name Description
FIRST Class 1: Passenger car, small van, small truck.
SECOND Class 2: Mid-size van, mid-size truck.
THIRD Class 3: Large van, 2-axis large truck.
FOURTH Class 4: 3-axis large truck.
FIFTH Class 5: Special truck with four axes or more.
SIXTH Class 6: Compact car.
TWO_WHEEL Class 7: Motorcycle.

Enum: RpOption
Name Description
FAST Fastest route.
FREE Toll-free route.
SHORTEST Shortest route.
NO_AUTO Route excluding motorway.
WIDE Main road first.
HIGHWAY Highway first.
NORMAL Normal road first.
RECOMMENDED Recommended route.
This is set as a default.

Navigation

The Navigation API starts directions from a user's current location to the entered destination via the Kakao Navi app. Implement this function by calling the navigateIntent() API, defined in the NaviClient class, which returns Intent.

You must pass the Location object containing destination information and the NaviOption object containing search criteria as arguments when calling navigateIntent(). You can specify only the desired search criteria in NaviOption. Even though you use startX, startY, and startAngle in the NaviOption class, the information of the starting point is only used for a reference and the current information is set to a starting point when getting directions. You cannot specify a starting point for navigation.

Here is an example of starting navigation.

// Navigation
if (NaviClient.instance.isKakaoNaviInstalled(requireContext())) {
    // If Kakao Navi is installed, navigation starts on Kakao Navi with WGS84.
    startActivity(
        NaviClient.instance.navigateIntent(
            Location("카카오 판교오피스", "127.108640", "37.402111"),
            NaviOption(coordType = CoordType.WGS84)
        )
    )
} else {
    // If Kakao Navi is not installed, the download page for Kakao Navi is open.
    startActivity(
        Intent(
            Intent.ACTION_VIEW,
            Uri.parse(Constants.WEB_NAVI_INSTALL)
        ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
    )
}

This API also provides a function to specify a list of waypoints. Include each local information about the waypoints in the Location object, and pass the list of Location as viaList when calling navigateIntent.

// Navigation
if (NaviClient.instance.isKakaoNaviInstalled(requireContext())) {
    // If Kakao Navi is installed, navigation via waypoints starts on Kakao Navi with WGS84.
    startActivity(
        NaviClient.instance.navigateIntent(
            Location("카카오 판교오피스", "127.108640", "37.402111"),
            NaviOption(coordType = CoordType.WGS84),
            // Set a list of waypoints.
            listOf(
                Location("판교역 1번출구", "127.111492", "37.395225")
            )
        )
    )
} else {
    // If Kakao Navi is not installed, the download page for Kakao Navi is open.
    startActivity(
        Intent(
            Intent.ACTION_VIEW,
            Uri.parse(Constants.WEB_NAVI_INSTALL)
        ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
    )
}

This is the screen of starting navigation on the Kakao Navi app.

End of support for Kakao Navi web version

In Android SDK 2.8.4 or higher, Kakao Navi does not support its web version that is started on a device where the Kakao Navi app is not installed. Instead, if Kakao Navi is not installed, the download page for Kakao Navi is open. Since the web version of navigation will be no longer available in the old versions, we recommend you to use the latest SDK.

Share location

The Sharing location API provides a screen to share the destination specified on the Kakao Navi app. To implement this function, call the shareDestinationIntent() API, defined in the NaviClient class, which returns Intent.

You must pass the Location object containing destination information and the NaviOption object containing search criteria as arguments when calling shareDestinationIntent(). You can specify only the desired search criteria in NaviOption. Even though you use startX, startY, and startAngle in the NaviOption class, the information of the starting point is only used for a reference and the current information is set to a starting point when getting directions. You cannot specify a starting point for navigation.

// Sharing location
if (NaviClient.instance.isKakaoNaviInstalled(requireContext())) {
    // If Kakao Navi is installed, location is shared on Kakao Navi with WGS84.
    startActivity(
        NaviClient.instance.shareDestinationIntent(
            Location("카카오 판교오피스", "127.108640", "37.402111"),
            NaviOption(coordType = CoordType.WGS84)
        )
    )
} else {
    // If Kakao Navi is not installed, the download page for Kakao Navi is open.
    startActivity(
        Intent(
            Intent.ACTION_VIEW,
            Uri.parse(Constants.WEB_NAVI_INSTALL)
        ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
    )
}

This API also provides a function to specify a list of waypoints. Include each local information about the waypoints in the Location object, and pass the list of Location as viaList when calling shareDestinationIntent.

// Sharing location
if (NaviClient.instance.isKakaoNaviInstalled(requireContext())) {
    // If Kakao Navi is installed, location is shared on Kakao Navi with WGS84.
    startActivity(
        NaviClient.instance.shareDestinationIntent(
            Location("카카오 판교오피스", "127.108640", "37.402111"),
            NaviOption(coordType = CoordType.WGS84),
            // Set a list of waypoints.
            listOf(
                Location("판교역 1번출구", "127.111492", "37.395225")
            )
        )
    )
} else {
    // If Kakao Navi is not installed, the download page for Kakao Navi is open.
    startActivity(
        Intent(
            Intent.ACTION_VIEW,
            Uri.parse(Constants.WEB_NAVI_INSTALL)
        ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
    )
}

This is the screen of sharing location on the Kakao Navi app.

Legacy

To see how to integrate Kakao Navi using the Legacy Kakao SDK for Android, click this button. It is highly recommended to migrate to the new version of Android SDK as soon as possible because the Legacy version may not be supported anymore. The legacy guide is not provided in the English version. Refer to the original Korean documentation.

See more