Is there an API for Google Maps navigation in Android?

后端 未结 5 1265
野性不改
野性不改 2020-12-07 21:11

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

5条回答
  •  不思量自难忘°
    2020-12-07 22:10

    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.

提交回复
热议问题