Reputation: 3
I would like to create a polyline from point A to point B that highlights a certain route in google maps. I've checked here https://developers.google.com/maps/documentation/android/shapes . When I create a polyline it draws a straight line from point a to point b. Is there anyway to make this polyline follow the path of the street instead?
Upvotes: 0
Views: 2390
Reputation: 916
There is no directions api in google maps android v2. You have to use the javascript directions api to get a json/xml response and then parse through the output to get the "overview_polyline which has the points encoded. Your input should be the two points (A TO B) to the directions api
The base_64 encoded points (Google documentation) should have your lat/lng for the route. This might be of help - Link (although it uses android v1 api for the points, you can replace those with the v2 LatLng Point objects)
Upvotes: 1