Skip to content

Instantly share code, notes, and snippets.

@snowpero
Last active August 11, 2020 01:55
Show Gist options
  • Save snowpero/a22dc21bea9d7ee127a10c647ff17d29 to your computer and use it in GitHub Desktop.
Save snowpero/a22dc21bea9d7ee127a10c647ff17d29 to your computer and use it in GitHub Desktop.
길찾기 관련 Map Intent 정리
val desLng = 126.978390
val desLat = 37.303638
val title = "목적"
// 구글맵 길찾기
private fun findGoogleMap() {
Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=$desLat, $desLng&title=$title")).apply {
`package` = "com.google.android.apps.maps"
}.let {
startActivity(it)
}
}
// 네이버지도 길찾기
private fun findNaverMap() {
val exNaver = "nmap://route?dlat=$desLat&dlng=$desLng&dname=$title"
Intent(Intent.ACTION_VIEW, Uri.parse(exNaver)).let {
startActivity(it)
}
}
// 카카오지도 길찾기
private fun findKakaoMap() {
val exKakao = "kakaomap://route?ep=$desLat,$desLng"
Intent(Intent.ACTION_VIEW, Uri.parse(exKakao)).let {
startActivity(it)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment