Android - To draw a route between two geo points

后端 未结 2 1926
死守一世寂寞
死守一世寂寞 2021-02-02 04:42

In my direction class I have two geo points.One corresponds to current position and other is a fixed geo point.Current position will keeps changing.I need to draw route between

2条回答
  •  一个人的身影
    2021-02-02 05:03

    I think best solution is called android internal map activity to show route between two geo points . Please refer below code.

    String uri = "http://maps.google.com/maps?saddr=" + currentLatitude+","+currentLongitude+"&daddr="+fixedLatitude+","+fixedLongitude;
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
    intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
    startActivity(intent);
    

    It called built in map activity and draw a route path between current and fixed latitude and longitude.

提交回复
热议问题