On Android 1.0 there was a com.google.googlenav namespace for driving directions:
Route - Improved Google Driving Directions
But in newer SDK it was removed by some reason...
Android: DrivingDirections removed since API 1.0 - how to do it in 1.5/1.6?
On BlackBerry there is also lack of APIs for such stuff:
how to find the route between two places in Blackberry?
csie-tw gives a workaround (query gmaps for kml file and parse it):
Android - Driving Direction (Route Path)
Also Andrea made a DrivingDirections helper classes for Android.
I wrote a little helper for this functionality, in j2me, so I would like to share my samples on Android and BlackBerry.
UPDATE
As it was stated in comments, it's not officially allowed Google Maps APIs Terms of Service :
Google Maps/Google Earth APIs Terms of Service
Last updated: May 27, 2009
...
10. License Restrictions. Except as expressly permitted under the Terms, or unless you have received prior written authorization from Google (or, as applicable, from the provider of particular Content), Google's licenses above are subject to your adherence to all of the restrictions below. Except as explicitly permitted in Section 7 or the Maps APIs Documentation, you must not (nor may you permit anyone else to):
...
10.9 use the Service or Content with any products, systems, or applications for or in connection with:
(a) real time navigation or route guidance, including but not limited to turn-by-turn route guidance that is synchronized to the position of a user's sensor-enabled device;
and may be disabled for certain apps (somehow, at least on Android)... From Geocode scraping in .NET conversation:
This is not allowed by the API terms of use. You should not scrape Google Maps to generate geocodes. We will block services that do automated queries of our servers.
Bret Taylor
Product Manager, Google Maps
Would be grateful for any alternatives and/or suggestions!
Thanks!
J2ME Map Route Provider
maps.google.com has a navigation service which can provide you route information in KML format.
To get kml file we need to form url with start and destination locations:
Next you will need to parse xml (implemented with SAXParser) and fill data structures:
Network connection is implemented in different ways on Android and Blackberry, so you will have to first form url:
then create connection with this url and get InputStream.
Then pass this InputStream and get parsed data structure:
Full source code RoadProvider.java
BlackBerry
See full code on J2MEMapRouteBlackBerryEx on Google Code
Android
See full code on J2MEMapRouteAndroidEx on Google Code