Reputation: 2086
Very recent i have to complete a project which have a small portion of Google map. I drew route between two Geo points. But i have to draw route from my Geo point to destination Geo point. Here is an important note is that my location is not static.It will change with my position.And I have to draw route from this current position to destination. Is it possible to draw such a dynamic route?
Upvotes: 1
Views: 1550
Reputation: 5431
Use this
Intent i = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:q=" +destLat+ ","+destLon+""));
this.startActivity(i);
I guess it will work..
Upvotes: 3
Reputation: 34765
Refer this link to draw driving path in your application. You just need to add the four classes present in the link in your project and call the below lines when you need to display the route.
SharedData data = SharedData.getInstance();
data.setAPIKEY("0RUTLH7cqd6yrZ0FdS0NfQMO3lioiCbnH-BpNQQ");//set your map key here
data.setSrc_lat(17);//set your src lat
data.setSrc_lng(78);//set your src lng
data.setDest_lat(18);//set your dest lat
data.setDest_lng(77);//set your dest lng
startActivity(new Intent(YourActivity.this,RoutePath.class));//add RoutePath in your manifeast file
//Also add the permission to your manifeast file
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
Upvotes: 0