I’m trying to use the Google directions API to show directions on my mapview but I am having difficulties getting the data from the JSON response. I can get the “levels” and “points” strings but can’t work out how to decode them to points on the map.
Any help would be much appreciated.
I have a class which can decode them for you, add the class below then call in your code like this:
where
pointsandlevelsare the data you’ve extracted from the JSON response. You can then go through the array of geopoints drawing a line between them to display your directions.Hope this helps! Kenny
EDIT: It would seem that the google directions API no longer returns the zoom levels string as part of the JSON response, not to worry though, all we were using this for was to check the number of points, so we can simply put these into a list like:
EDIT: OLD CODE