Getting the nearest street/road coordinates in android

android, android-location, google-maps, google-maps-api-3

Solution

If you are referring to Directions Service, then it uses Google Directions API internally as stated in the overview:

This object communicates with the Google Maps API Directions Service which receives direction requests and returns computed results.

As there is no native API for Android yet, I suggest using Directions API directly.

See my answer here.

Problem

In javascript, using `Google maps api`s we specify options such as `google.maps.TravelMode.DRIVING`. Do we have any equivalent for `TravelMode` in android? I couldn't see anything in `android.location.LocationManager` or `android.location.Criteria` I've thought of following options: Using some `TravelMode` alternative, get coordinates approximated to nearest street/road. Alternatively, (Not preferred as it will be slow) get the coordinates normally and then probably send it to some google api(This will be pretty slow as there are many points) and get the coordinates corrected to the nearest street coordinates. Or in case if there exists some (google-maps) javascript framework, it may be used to get corresponding street coordinates. Edit1: I've also looked into this. and hence into `android.location.Geocoder`. The `getFromLocation` in this class seems to do most of the work. However, I'm afraid, of an additional delay while acquiring the nearest address.

Original source

Related problems