Created
December 31, 2019 03:32
-
-
Save javymarmol/f0f4822c04eb73ed4e1b1725bb897d87 to your computer and use it in GitHub Desktop.
Intent para abrir mapa en android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Con latitude y longitude | |
Uri gmmIntentUri = Uri.parse("geo:0,0" + "?q=" + trayecto.getLatitude() + "," + trayecto.getLongitude()); | |
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); | |
mapIntent.setPackage("com.google.android.apps.maps"); | |
startActivity(mapIntent); | |
// Con dirección | |
Uri gmmIntentUri = Uri.parse("geo:0,0" + "?q=" + trayecto.getAddress()); | |
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); | |
mapIntent.setPackage("com.google.android.apps.maps"); | |
startActivity(mapIntent); | |
// Navigation con latitude y longitude | |
Uri gmmIntentUri = Uri.parse("google.navigation:q=" + trayecto.getLatitude() + "," + trayecto.getLongitude()); | |
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); | |
mapIntent.setPackage("com.google.android.apps.maps"); | |
startActivity(mapIntent); | |
// Navigation con dirección | |
Uri gmmIntentUri = Uri.parse("google.navigation:q=" + trayecto.getAddress()); | |
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); | |
mapIntent.setPackage("com.google.android.apps.maps"); | |
startActivity(mapIntent); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment