I am trying to send an intent to Google Maps to show driving directions between multiple points. I am using the method listed here but it seems not to be working very well. The ultimate functionality of the app will be to create the url for the map dynamically, but I have created a static one with a bunch of random points for the sake of testing:
My exact code is:
String mapUrl = "https://maps.google.com/maps?saddr=San+Francisco,+CA&daddr=Los+Angeles,+CA+to:Phoenix,+AZ+to:Houston,+TX+to:Jacksonville,+FL+to:New+York,+NY+to:Buffalo,+NY+to:Chicago,+IL+to:Seattle,+WA+to:San+Jose,+CA";
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(mapUrl));
startActivity(i);
If I send this to the browser from the "Complete action using" menu, then it works correctly. (FWIW, it also works correctly if I just copy+paste the url into a web browser on my desktop) On the other hand, if I send it to the Maps application, then it does not behave correctly. On some of the older devices that I have running 2.2 and 2.3, it shows driving directions but only 2 of the points are marked, one of which not even being one of the points I passed in the url, and the driving directions are crazy with multiple routes going back and forth between locations. On any 4.X device, it displays nothing and either says "Network failure" or "No route found". I do not have any 3.X devices however I expect it would behave in a similar fashion to one of these.
I do not want to use a MapView as this is pretty overkill for the minor map-based requirements of my app. I just want to be able to send an intent to the Maps app showing a route between two locations with waypoints in between. I could not find any clear answers in the documentation for the new Maps api, is this possible?