I'm trying to develop an Android App to go with my web app www.scroutenise.com, so I made a backend API to mimic the behaviour of the Javascript app which returns
Both are in the same format provided by the Google Maps API. Great - with JS I can easily render this on a Google Map.
So far in my App I'm successfully communicating with the API and getting the full results - keep in mind the API is a WebSockets API so there's no URL - and I've got a Google Map showing.
The only thing I can't find documentation or tutorials for is how to display directions on the map. I'm sure I could figure out how to place Markers, but the directions aspect is a pretty important aspect of my app. Is it even possible? Are there some Ts&Cs that Google has to stop people from making a directions-related app?
Thanks for reading, I hope somebody can help :)
I don't get what you means by directions here, But you can draw path using the way described in this post.
http://csie-tw.blogspot.com/2009/06/android-driving-direction-route-path.html
In Android, you can specify driving directions through the use of an Intent:
String geoUriString = "http://maps.google.com/maps?" +
"saddr=" + srcLat + "," + srcLng + "&daddr=" + dstLat + "," + dstLng;
Intent mapCall = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUriString));
Then based on the apps installed on your device (navigation, maps, etc) the user will be able to receive directions from one of those apps.
String uri= "https://www.google.com/maps/dir/" +
fromLat + "," + fromLng + "/" + toLat + "," + toLng;
Intent mapCall = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
OR only location of "to" and user must turn on GPS:
String uri= "https://www.google.com/maps/dir//" + toLat + "," + toLng;
Intent mapCall = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));