Notifying when driver arrives and changing google map's pointer were implemented today.
Once we have our GeoApiContext, we can now use the DirectionsAPI class (which has a static method called newRequest) to request direction information. This newRequest method takes a GeoApiContext as an argument, which then returns us a DirectionsApiRequest.
On the DirectionsApiRequest object we have some methods that we need to set before we make this request. First we need to set our TravelMode, which can be Driving, Bicycling, Walking or Transit.
We then need to set our origin and our destination points. To accomplish this, there are two separate methods that return a DirectionsApiRequest that take either a LatLng or a String as an argument. What’s awesome about the methods which take in a String, is that the Latitude and Longitude will be automatically calculated based on the String address that you provide.
Lastly, we can call the departureTime method, so that we know the travel times that are returned are based on the departure time we provided. This method takes a simple DateTime object.
Now we can call the await method on the DirectionsApiRequest. This will make a synchronous call to the web service and return us a DirectionsResultobject.
Comments
Post a Comment