This document describes how to integrate the Kakao Navi API into your service with the Kakao SDK for Android ("Android SDK").
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.")
}
Reference | App setting |
---|---|
[SDK] navigateIntent() [SDK] Location [SDK] NaviOption |
Install Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms | - | - |
Starts directions from a user's current location to the entered destination.
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.
Call the navigateIntent()
method defined in the NaviClient
class. You must pass destination as Location
object that containing the destination information as an argument. You can also specify the desired search criteria using NaviOption
.
// 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. To add waypoints, pass viaList
through Location
object.
// 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)
)
}
Reference | App setting |
---|---|
[SDK] shareDestinationIntent() [SDK] Location [SDK] NaviOption |
Install Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms | - | - |
Provides a screen to share the destination specified on the Kakao Navi app.
Call the shareDestinationIntent()
method in the NaviClient
class, which returns Intent
. You must pass destination as Location
object containing the location information as an argument. You can also specify the desired search criteria using NaviOption
.
// 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. To share loacation with waypoints, pass viaList
through Location
object.
// 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)
)
}