1
Good morning, I am new in the android world, I would like to know how to run the application google maps just by pressing my button?
I want to implement my coordinates and reach the other registered point.
1
Good morning, I am new in the android world, I would like to know how to run the application google maps just by pressing my button?
I want to implement my coordinates and reach the other registered point.
2
You need to call Google Maps via Intent
, thus:
private void callExternalMap(LatLng origem, LatLng destino) {
try {
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr=" + origem.latitude + "," + origem.longitude + "&daddr=" + destino.latitude + "," + destino.longitude));
/*
* Se você quiser que o usuário vá direto para o aplicativo do Google Maps, use a linha abaixo.
* Caso não queira (de opções para o usuário abrir em outros aplicativos de mapas no celular), apenas apague a linha abaixo.
*/
intent.setComponent(new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"));
startActivity(intent);
} catch (Exception ex) {
Toast.makeText(this, "Verifique se o Google Maps está instalado em seu dispositivo", Toast.LENGTH_SHORT).show();
}
}
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.
You want: 1) Start the Google Maps from your app, with a particular action or 2) Have a map of Google Maps embedded in your app? As these points are not clear, follow two links to help: 1) https://developers.google.com/maps/documentation/android/intents and 2) https://developers.google.com/maps/documentation/android/start
– Wakim
Start my app and in my menu start an action by calling google maps out of my app.
– Mauro Santos