This document describes how to integrate the Kakao Navi API into your service with the Kakao SDK for Android ("Android SDK").
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. Because the ReactiveX Android SDK does not provide the Kakao Navi API, you must use the Kakao Navi module that the Android SDK provides.
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 ("app"). If the Kakao Navi app is installed on a user's device, the app is launched. If not, the user should be directed to the download page for the Kakao Navi app.
To check if the Kakao Navi app is installed on a user's device, use the isKakaoNaviInstalled()
method. 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.")
}
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms | - | - |
To start navigation from a user's current location to the entered destination on the Kakao Navi app, call the navigateIntent()
method defined in the NaviClient
class. You must pass destination containing the destination information as an argument. You can also specify the desired search criteria using NaviOption. To add waypoints, pass viaList
through Location object.
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. Thus, implement to open the download page for Kakao Navi if Kakao Navi is not installed. Because the web version of navigation will be no longer available in the old versions, we recommend you to use the latest SDK. For more information, refer to Notice.
Name | Type | Description | Required |
---|---|---|---|
destination | Location |
Destination information. | O |
option | NaviOption |
Search criteria to get directions to the destination. | X |
viaList | Location |
Waypoint information. Up to three waypoints are allowed. |
X |
Name | Type | Description | Required |
---|---|---|---|
name | String |
Location name. (Example: "My Home", "Company") |
O |
rpFlag | String |
Destination link. Currently not supported. |
X |
x | String |
Longitude coordinate. | O |
y | String |
Latitude coordinate. | O |
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.
Name | Type | Description | Required |
---|---|---|---|
coordType | CoordType |
Coordinate system to use. | X |
vehicleType | VehicleType |
Vehicle type. (Default: Vehicle type the user set on the Kakao Navi app) |
X |
rpOption | RpOption |
Criteria to optimize routes. | X |
routeInfo | Boolean |
Whether to view entire route information to the destination. | X |
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. |
X |
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. |
X |
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. |
X |
returnUri | String |
URI to be redirected when stopping navigation (viewing entire routes). | X |
Name | Description |
---|---|
WGS84 | World Geodetic System 84 coordinate system. |
KATEC | Katec coordinate system. This is set as a default. |
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. |
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. |
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, open the download page for Kakao Navi.
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, open the download page for Kakao Navi.
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(Constants.WEB_NAVI_INSTALL)
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
)
}
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms | - | - |
To share the specified location through the Kakao Navi app, call the shareDestinationIntent()
method in the NaviClient
class, which returns Intent
. You must pass destination containing the location information as an argument. You can also specify the desired search criteria using NaviOption. To share loacation with waypoints, pass viaList
through Location object.
The parameters are the same as the parameters for navigateIntent()
.
// 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, open the download page for Kakao Navi.
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, open the download page for Kakao Navi.
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(Constants.WEB_NAVI_INSTALL)
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
)
}