Is there an API for Google Maps navigation in Android?
Adding onto Scorpion's code (which works perfectly) you might want to get your current location
Location currentLocation = googleMap.getMyLocation();
double latitudeCurr = currentLocation.getLatitude();
double longitudeCurr = currentLocation.getLongitude();
saddr
being starting address
daddr
being destination address
final Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("+http://maps.google.com/maps?" "saddr="
+ latitudeCurr + "," + longitudeCurr + "&daddr="
+ latitude + "," + longitude));
intent.setClassName("com.google.android.apps.maps",
"com.google.android.maps.MapsActivity");
startActivity(intent);
This is what I use in my application
The best way to get direction and routes you can use the Web Service of Google Maps. It will provide you everything. I have used this in my application.
Here is the example where saddr = source address & daddr= destination address(i.e. latitude & longitude). You can also pass string as address instead of lat/lng.
final Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?" + "saddr="+ latitude + "," + longitude + "&daddr=" + latitude + "," + longitude));
intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
startActivity(intent);
Hope this will help you.