I am developing navigation base application. In these application, I have to open Map application to draw path between source & destination latitude/address with Traffic Enable.
I already create functionality to open Google map through Intent and draw the path between two points.
Is it possible that, to add Traffic Layer at time of passing Intent? Or Which parameter I need to add?
Thanks in advance.
You can do this way:
I have considered my start location as current location.
Your destination location will be dynamic, as provided below:
double destinationLatitude = 22.3000;
double destinationLongitude = 73.2003;
String url = "http://maps.google.com/maps?f=d&daddr="+ destinationLatitude+","+destinationLongitude+"&dirflg=d&layer=t";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
Done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With