How do I launch Google Maps from my own application to show road directions from current position (GPS) to a specified address?
This intent should launch the appropriate Maps Activity with the directions input screen populated with current location and a destination point:
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?f=d&daddr=51.448,-0.972"));
intent.setComponent(new ComponentName("com.google.android.apps.maps",
"com.google.android.maps.MapsActivity"));
startActivity(intent);
Uri uri = Uri.parse("geo:40.763500,-73.979305");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
Try it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With