Identify the nearest vehicle with the distance matrix
The distance matrix API works by taking a list of origin locations and a list of destination locations, either of which could be used for the customer or vehicles depending on the viewer of the application (the origin might be the vehicle looking for customers or the customer looking for vehicles).
Origins and destinations can be specified as coordinate pairs or as addresses, the latter will be matched when the service is called.
As with the Google Directions API, the Distance Matrix API can specify parameters to generate results based upon current traffic from the location of the vehicle.
The following URL shows the call between a person standing at Euston Station and a number of vehicles on surrounding roads.
Responses from the Distance Matrix API consist of a simple match between the origin and destination and the time-resolved.
On Android you can use the Client Libraries to easily connect to the web services, this is especially useful if you are using the Google Maps API on the Premium Plan where a proxy service should be used to contain the cryptographic key that is used when authenticating access to the web service and should not be shared within a mobile application directly. You can find out more at the following resource: