Skip to content

Instantly share code, notes, and snippets.

@iamcodder
Last active April 26, 2022 12:59
Show Gist options
  • Save iamcodder/db720a63b3b106ce75acdfdfaccc7f2f to your computer and use it in GitHub Desktop.
Save iamcodder/db720a63b3b106ce75acdfdfaccc7f2f to your computer and use it in GitHub Desktop.
fun navigateMaps(){
val uri = if(isHmsAvailable(context) == true)
"petalmaps://navigation?daddr=${selectedMarker.latitude}, ${selectedMarker.longitude}&type=drive"
else
"http://maps.google.com/maps?f=d&hl=en&saddr=" + currentLoc?.latitude + "," + currentLoc?.longitude + "&daddr=" + selectedMarker.latitude + "," + selectedMarker.longitude
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(uri))
startActivity(Intent.createChooser(intent, "Harita Uygulamasını Seçiniz."))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment