Android Navigation Intention

If you send the direction of Google Maps to your Android phone, you have the opportunity to open it in the Maps application, it seems completely logical, like the code behind it.

Now, once in the Maps application, you have the opportunity to open these directions in the application for navigation with these exact directions.

How it works? It should not be so difficult to do, I know about the intention with

"google.navigation:q=..."

But this only works on some devices and only with coordinates or addresses ... No map directions?

Can anyone help me with this?

EDIT:

Here's what the url looks like:

https://maps.google.com/maps?saddr=Durbanville,+Cape+Town,+Western+Cape,+South+Africa&daddr=Parow+North,+Cape+Town,+South+Africa+to:Somerset+West , + Cape + Town, + South + Africa + to: Milnerton, + Cape + Town, + South + Africa & hl = en & ll = -33.955037,18.657532 & spn = 0.25032,0.528374 & sll = -33.911454,18.601913 & sspn = 0.250448,0.528374 & geocode = Fcz -_0dzIkcASlBKWkzGlfMHTFTuxOUSmpCAw% 3BFQTi-v0d5oMbASld0qgMSFrMHTG2XqWY145Ttw% 3BFfUG-P0dPHEfASk398T7ZbXNHTG5a6EH84n4Qg% 3BFVU8-_0doEkaASnrz9UPVVnMHTFz2N4nnkA7XQ & oq = parow & mra = ls & t = m & z = 12

+1
source share
2 answers

If you create a web url in the format

http://maps.google.com/maps?saddr=[lat 1],[lon 1]&daddr=[lat 2],[lon 2]

[lat 1] [lon 1] - , [lat 2] [lon 2] String, intent:

Intent navIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(navigationUrl));
activity.startActivity(navIntent);

-, Google .

EDIT:

URL- ( )

+to:[lat 3],[lon 3]

.

, 4 :

http://maps.google.com/maps?saddr=[lat 1],[lon 1]&daddr=[lat 2],
  [lon 2]+to:[lat 3],[lon 3]+to:[lat 4],[lon 4]
+10

, , Google . - Google:

Uri routeUri = Uri.parse("http://maps.google.com/maps?&saddr=" +
                                MyApplication.Lat + "," +
                                MyApplication.Lon + "&daddr=" + merchantAddr.getText());

Intent i = new Intent(Intent.ACTION_VIEW, routeUri);
startActivity(i);

, Geo lat/lon, - , . , -, Google.

0

All Articles