Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an API for Google Maps navigation in Android?

I am developing an Android app where I am using Google Maps. It is working well and good. But

After loading the map when a user has clicked “Get Directions”, Google Maps comes up with the direction line, however there is no way to get the turn by turn written directions. If you just open Google Maps and Get Directions you can toggle back and forth between the Map and the Direction List.

Is there any API available to get all the features as given in default Google map of Android device?

like image 808
Sudipta Som Avatar asked Mar 04 '11 09:03

Sudipta Som


1 Answers

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.

like image 100
Scorpion Avatar answered Oct 19 '22 15:10

Scorpion