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

Kakao Navi

Flutter

This document describes how to integrate the Kakao Navi API into your service with the Kakao SDK for Flutter ("Flutter SDK").

The Flutter SDK supports Android, iOS, and web platforms. However, if users use your web app in environments other than Android and iOS, they cannot use the Kakao Navi services because the Kakao Navi services are available only in the Kakao Navi mobile app.

Before you begin

Before using Kakao Navi APIs with the Flutter SDK,

  1. Complete the prerequisites.
  2. Register Allowlist to allow the Kakao Navi application to be launched on iOS platform.
  3. After adding kakao_flutter_sdk_navi in pubspec.yaml by referring to Install SDK, add the following libraries in your dart file.
import 'package:kakao_flutter_sdk_navi/kakao_flutter_sdk_navi.dart';

Check if Kakao Navi is available

To figure out if it is possible to launch the Kakao Navi app on a user's device, you can use the isKakaoNaviInstalled() method.

If the Kakao Navi app is installed on a user's mobile device, isKakaoNaviInstalled() returns true and the Kakao Navi app is launched. If not installed, false is returned, and thus the user should be directed to the download page for the Kakao Navi app.

In the case of a web app, the isKakaoNaviInstalled() method returns a different boolean value depending on the user environment where your web app is running. If a user on an Android or iOS environment attempts to start navigation or share location from the web app, isKakaoNaviInstalled() returns true regardless of whether Kakao Navi is installed. Thus, in the web app, true does not guarantee that Kakao Navi is installed on the user's Android or iOS device. On the other hand, in other environments where your web app is running such as Windows or Mac operating systems, false is returned.

bool result = await NaviApi.instance.isKakaoNaviInstalled();
if (result) {
    print('Possible to launch Kakao Navi for navigation or location sharing.');
} else {
    print('Kakao Navi app is not installed.');
    // If Kakao Navi is not available on a user's mobile device, open the download page for Kakao Navi. 
    launchBrowserTab(Uri.parse(NaviApi.webNaviInstall));
}

Start navigation

Basic information
Permission Prerequisite Kakao Login User consent Reference
- Register platforms - - navigate()

To start navigation from a user's current location to the entered destination on the Kakao Navi app, call the navigate() method in the NaviApi 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.

Parameter

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
Location
Name Type Description Required
name String Location name.
(Example: "My Home", "Company")
O
x String Longitude coordinate. O
y String Latitude coordinate. O
rpFlag String Destination link.
Currently not supported.
X
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.

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 Bool Whether to view entire route information to the destination.
startX String 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 String 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
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.
twoWheel Class 7: Motorcycle.
Enum: RpOption
Name Description
fast Fastest route.
free Toll-free route.
shortest Shortest route.
noAuto Route excluding motorway.
wide Main road first.
highway Highway first.
normal Normal road first.
recommended Recommended route.
This is set as a default.

Sample: Navigation

if (await NaviApi.instance.isKakaoNaviInstalled()) {
  // If Kakao Navi is available on user's device, navigation starts on Kakao Navi with KATEC.
  await NaviApi.instance.navigate(
    destination: Location(name: '카카오 판교오피스', x: '321286', y: '533707'),
    viaList: [
      Location(name: '판교역 1번출구', x: '321525', y: '532951'),
    ],
  );
} else {
  // If Kakao Navi is not available, open the download page for Kakao Navi. 
  launchBrowserTab(Uri.parse(NaviApi.webNaviInstall));
}

Sample: Navigation via waypoints

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 navigate().

if (await NaviApi.instance.isKakaoNaviInstalled()) {
  // If Kakao Navi is available on user's device, navigation to the specified destination via waypoints starts on Kakao Navi on the KATEC coordinate system.
  await NaviApi.instance.navigate(
    destination: Location(name: '카카오 판교오피스', x: '321286', y: '533707'),
    viaList: [ 
      Location(name: '판교역 1번출구', x: '321525', y: '532951'),
    ],
  );
} else {
  // If Kakao Navi is not available, open the download page for Kakao Navi.
  launchBrowserTab(Uri.parse(NaviApi.webNaviInstall));
}

Share location

Basic information
Permission Prerequisite Kakao Login User consent Reference
- Register platforms - - shareDestination()

To share the specified location through the Kakao Navi app, call the shareDestination() method in the NaviApi class. 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.

Parameter

The parameters are the same as the parameters for navigate().

Sample: Sharing location

if (await NaviApi.instance.isKakaoNaviInstalled()) {
  // If Kakao Navi is available on user's device, location is shared on Kakao Navi on the KATEC coordinate system.
  await NaviApi.instance.shareDestination(
    destination: Location(name: '카카오 판교오피스', x: '321286', y: '533707'),
  );
} else {
  // If Kakao Navi is not available, open the download page for Kakao Navi.
  launchBrowserTab(Uri.parse(NaviApi.webNaviInstall));
}

Sample: Sharing location via waypoints with WGS84

if (await NaviApi.instance.isKakaoNaviInstalled()) {
  // If Kakao Navi is available on user's device, location including waypoints is shared on Kakao Navi on the WGS84 coordinate system.
  await NaviApi.instance.shareDestination(
    destination: Location(name: '카카오 판교오피스', x: '127.108640', y: '37.402111'),
    option: NaviOption(coordType: CoordType.wgs84),
    viaList: [ 
      Location(name: '판교역 1번출구', x: '321525', y: '532951'),
    ],
  );
} else {
  // If Kakao Navi is not available, open the download page for Kakao Navi.
  launchBrowserTab(Uri.parse(NaviApi.webNaviInstall));
}

See more