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.
To use Kakao Navi APIs on a iOS device, set Allowlist.
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));
}
Reference | App setting |
---|---|
navigate() Location NaviOption |
Install Initialize Set Allowlist |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms | - | - |
Starts directions from a user's current location to the entered destination.
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 as Location
object containing the destination information as an argument. You can also specify the desired search criteria using NaviOption
.
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));
}
This API also provides a function to specify a list of waypoints. To add waypoints, pass viaList
through Location
object.
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));
}
Reference | App setting |
---|---|
shareDestination() Location NaviOption |
Install Initialize Set Allowlist |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms | - | - |
Provides a screen to share the destination specified on the Kakao Navi app.
To share the specified location through the Kakao Navi app, call the shareDestination()
method in the NaviApi
class. You must pass destination as Location
object containing the location information as an argument. You can also specify the desired search criteria using NaviOption
.
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));
}
To share loacation with waypoints, pass viaList
through Location
object.
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));
}