This document describes how to integrate the Kakao Navi API into your service with the Kakao SDK for iOS (hereinafter referred to as 'iOS SDK').
To implement Kakao Navi, you need to install the Kakao Navi module. After adding KakaoSDKNavi
(Kakao Navi module) to the Podfile, add the import statement for the module as follows.
import KakaoSDKNavi
The Kakao Navi API provides the navigateUrl()
method for navigation and the shareUrl()
method for location sharing.
navigateUrl()
and shareUrl()
return URL
to invoke the navigation and location sharing function with the Kakao Navi application (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 should be directed to the download page for the Kakao Navi app.
To allow a user's device to launch the Kakao Navi app, you must set a URI scheme in the plist file as follows:
LSApplicationQueriesSchemes
key with an array type in the plist file. LSApplicationQueriesSchemes
key.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 navigateUrl()
method defined in the NaviApi
class, which returns URL
to launch the Kakao Navi app. 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 NaviLocation object.
In iOS 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 | NaviLocation |
Destination information. | O |
option | NaviOption |
Search criteria to get directions to the destination. | X |
viaList | NaviLocation |
Waypoint information. Up to three waypoints are allowed. |
X |
Name | Type | Description | Required |
---|---|---|---|
name | String |
Location name. (Example: "My Home", "Company") |
O |
x | Int64 |
Longitude coordinate. | O |
y | Int64 |
Latitude coordinate. | O |
rpFlag | String |
Destination link. Currently not supported. |
X |
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. Refer to CoordType below. | X |
vehicleType | VehicleType |
Vehicle type. Refer to VehicleType below. (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 | Int64 |
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 | Int64 |
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 | URL |
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 |
---|---|
1 | First, Class 1: Passenger car, small van, small truck. |
2 | Second, Class 2: Mid-size van, mid-size truck. |
3 | Third, Class 3: Large van, 2-axis large truck. |
4 | Fourth, Class 4: 3-axis large truck. |
5 | Fifth, Class 5: Special truck with four axes or more. |
6 | Sixth, Class 6: Compact car. |
7 | TwoWheel, Class 7: Motorcycle. |
Name | Description |
---|---|
1 | Fast, Fastest route. |
2 | Free, Toll-free route. |
3 | Shortest, Shortest route. |
4 | NoAuto, Route excluding motorway. |
5 | Wide, Main road first. |
6 | Highway, Highway first. |
8 | Normal, Normal road first. |
100 | Recommended, Recommended route. This is set as a default. |
let destination = NaviLocation(name: "카카오판교오피스", x: "321286", y: "533707")
let viaList = [NaviLocation(name: "판교역 1번출구", x: "321525", y: "532951")]
guard let navigateUrl = NaviApi.shared.navigateUrl(destination: destination, viaList: viaList) else {
return
}
if UIApplication.shared.canOpenURL(navigateUrl) {
UIApplication.shared.open(navigateUrl, options: [:], completionHandler: nil)
} else {
UIApplication.shared.open(NaviApi.webNaviInstallUrl, options: [:], completionHandler: nil)
}
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms | - | - |
To share the specified location through the Kakao Navi app, call the shareUrl()
method in the NaviApi
class, which returns URL
. 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 NaviLocation object.
The parameters are the same as the parameters for navigateUrl()
.
let destination = NaviLocation(name: "카카오판교오피스", x: "321286", y: "533707")
guard let shareUrl = NaviApi.shared.shareUrl(destination: destination) else {
return
}
if UIApplication.shared.canOpenURL(shareUrl) {
UIApplication.shared.open(shareUrl, options: [:], completionHandler: nil)
}
else {
UIApplication.shared.open(NaviApi.webNaviInstallUrl, options: [:], completionHandler: nil)
}