Harsha M V
Harsha M V

Reputation: 54949

Android Maps Direction

I am looking to integrate Directions between a Lat, Long and the present location of the User. I would want at the click of the button to direct the user to the installed Google Maps/ Other Apps and show the directions.

I search SO and Google but couldn't find a good source and hence am posting this Question.

Tour Bangalore seems to be able to do it. Couldnt find documentation on how to achieve this

Upvotes: 2

Views: 366

Answers (2)

iagreen
iagreen

Reputation: 32016

The only official intents documented are given here. They do not include directions.

It has been noted that the following intent structure works with Google Maps. It seems the current Google Maps ingests the google maps http requests. It is probably the method used by the apps you've seen. However, it likely only works with Google Maps, and since it appears to be undocumented, there is no guarantee it will continue to work with future version of Google Maps.

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?daddr=33.881894,-92.199623&saddr=My+Location"));

where daddr is the destination location, and saddr is the source location. They can either be lat/lng's or search terms. "My+Location" is a search term in the above example, so it unlikely to work in locales with a language other than English.

Upvotes: 2

CommonsWare
CommonsWare

Reputation: 1006664

There is no documented and supported Intent structure for this, sorry. You can bring up a map on a point, but not force Maps to obtain directions.

Also, bear in mind that:

  • not all devices have Google Maps
  • the user might not want to use Google Maps, even if it is installed (e.g., they bought some third-party mapping app that they wish to use)

Upvotes: 2

Related Questions