Saturday 27 October 2018

TravelTimeCalculator: Creating a Google Directions Request

After adding a button on the Google Maps view, I've added a listener to it that fetches the center coordinate for the view (cameraTarget).



If those coordinates are available, the app will build a string that will query the Google Directions API for biking between two coordinates:

https://maps.googleapis.com/maps/api/directions/json?origin=55.59,13.019&destination=55.6,13.019&mode=bicycling&key=<MY_API_KEY>

After typing the string into a web browser, I get:

In the next blog post, I'll send the request from the app and analyze the result string.

No comments:

Post a Comment