Home android Android Run Yandex Navigator

Android Run Yandex Navigator

Author

Date

Category

Is it possible in Android to programmatically run Yandex Navigator and transfer the coordinates of points A and the point b so that it starts to lay the route?

We know in advance that on the device 100% there is Yandex navigator


Answer 1, Authority 100%

you can. Taken Hence :

// Create an intrenter to build a route
INTENT INTENT = NEW INTENT ("RU.YANDEX.YANDEXNAVI.Action.build_route_on_map");
INTENT.SETPACKAGE ("RU.YANDEX.YANDEXNAVI");
PackageManager PM = getPackagemanager ();
List & lt; ResolveInfo & gt; infos = pm.queryintentactivities (INTENT, 0);
// Check if Yandex. Navigator installed
if (infos == null || infos.size () == 0) {
  // If not - we open the navigator page on Google Play
  INTENT = NEW INTENT (INTENT.ACTION_VIEW);
  INTENT.SETDATA (URI.PARSE ("MARKET: // Details? id = ru.yandex.yandexnavi"));
} else {
  INTENT.PUTEXTRA ("LAT_FROM", 55.751802);
  INTENT.PUTEXTRA ("LON_FROM", 37.586684);
  INTENT.PUTEXTRA ("Lat_To", 55.758192);
  INTENT.PUTEXTRA ("LON_TO", 37.642817);
}
// Run the necessary Activity
StartActivity (Intent);

Answer 2, Authority 20%

You can run like this. Official documentation

uri uri = uri.parse ("yandexnavi: // build_route_on_map? Lat_From = 55.74 & amp; lon_from = 37.60 & amp; lat_to = 55.76 & amp; lon_to = 37.64);
INTENT INTENT = NEW INTENT (INTENT.ACTION_VIEW, URI);
INTENT.SETPACKAGE ("RU.YANDEX.YANDEXNAVI");
StartActivity (Intent);
Previous articleMaven in Intellij Idea
Next articleAngular jqlite error

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions