If you mail a Google Maps direction to your Android phone, you have the possibility to open it in the Maps appliaction, this seems perfectly logical, as does the code behind it.
Now, once in the Maps App, you have the possibility to open these directions in the Navigation App, with those exact directions.
How does this work? It must not be that difficult to do it, I know about the intent with
"google.navigation:q=..."
But this only works on some devices and only with coördinates or addresses... No Maps directions?
Can anyone help me out with this?
EDIT:
This is what the URL looks like:
After following answers above, I find myself in a country that Google Navigation service is not available. But the navigation intent still can be accomplished with Google Map by this:
It seems we can set the start point to Geo location with lat/lon, and end point to an address, and vice versa. The geo location seemed to be transformed to an address or road name in the Google Map.
If you create a web url in the format
where [lat 1] and [lon 1] are the latitude and longitude for the start point, and likewise [lat 2] and [lon 2] are the end point, and set it as a
String
, you can then send this to anintent
:This will give the user the option of opening a Web Browser, Google Maps, or Navigation.
EDIT:
For multiple destinations add the following to the end of the url (for each additional place)
as required.
So for 4 destinations you would have:
The url should like this: