Launch Yandex Maps by URL

You can run Yandex Maps mobile app from other applications and website pages. You can also launch a platform-agnostic web version of Yandex Maps.

This document describes the methods to launch the Yandex Maps app and web version of Yandex Maps.

Launch Yandex Maps mobile app from browser

For the user to launch the Yandex Maps app from a browser page, generate a relevant app link. Instead of the network protocol name (usually http or https), the link specifies the URL scheme responsible for launching the app.

The yandexmaps URL scheme is responsible for the Yandex Maps app launch. A link to open a map in the Yandex Maps app for Android and iOS, will look as follows:

<a href="yandexmaps://maps.yandex.com/?ll=37.62, 55.75&z=12" >Open
Moscow map in Yandex Maps</a>

For the list of parameters that can be specified in the URL, see sections Launch Yandex Maps iOS app and Launch Yandex Maps Android app.

Note

The link can be generated dynamically, depending on the platform. The platform-related information can be retrieved from:

  • navigator object, if the link is generated on the browser side (client side JavaScript)

  • HTTP headers, if the link is generated on the server side.

Launch Yandex Maps mobile app from native applications

Android

To launch the Yandex Maps from an Android-based Java app, create an object of the Intent type`. When the object is created, the ACTION_VIEW action (see action) and URI are passed to the constructor. After this, just call the startActivity method of the Context class, and the Activity relevant to the action will run. For example, to open a map with given center coordinates and zoom in Yandex Maps, you need to add the following code.

Uri uri = Uri.parse("yandexmaps://maps.yandex.ru/?ll=37.62,55.75&z=12");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

The standard ACTION_VIEW action is used to launch the app. The map center coordinates and scale are specified in URI.

The list of possible parameters is provided in the Launch Yandex Maps Android app section.

If the app launched is not installed on the device, the startActivity method call will stop the app. To check whether the relevant app is installed, use the queryIntentActivities method of the PackageManager class. If the app is not installed, you can open the Yandex Maps page in Google Play.

Uri uri = Uri.parse("yandexmaps://maps.yandex.com/");Intent intent = new Intent(Intent.ACTION_VIEW, uri);// Checking that at least one app which can run this action has been installed.
PackageManager packageManager = getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0);
boolean isIntentSafe = activities.size() > 0;
if (isIntentSafe) {
  startActivity(intent);
} else {
// Opening the Yandex Maps app page in Google Play.
  intent = new Intent(Intent.ACTION_VIEW);
  intent.setData(Uri.parse("market://details?id=com.yandex.yandexmaps"));  startActivity(intent);}

iOS

To run external apps from applications written in Objective‑C, use the openURL: method of the UIApplication class. The method is passed a URL containing a scheme of the app launched, and its startup parameters, if needed. For example, to open the Yandex Maps app and display the map of Moscow, you can use the following code.

[[UIApplication sharedApplication] openURL:
 [NSURL URLWithString:@"yandexmaps://maps.yandex.ru/?ll=37.62,55.75&z=12"]];

Here yandexmaps is the name of the Yandex Maps app URL scheme. The list of possible parameters is provided in the Launch Yandex Maps iOS app section.

Before calling the openURL method you should check if the Yandex Maps app is installed on the device. To do this, use the canOpenURL: method. If the app is not installed, you can open the Yandex Maps page in App Store.

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"yandexmaps://"]]) {   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"yandexmaps://maps.yandex.com/?ll=37.62,55.75&z=12"]];} else {// Opening the Yandex Maps page in App Store.
   [[UIApplication sharedApplication] openURL:    [NSURL URLWithString:@"https://itunes.apple.com/ru/app/yandex.maps/id313877526?mt=8"]];}

Launch web version of Yandex Maps

To launch the web version of Yandex Maps, pass the request parameters in the URL. The URL will look like this:

<a href="https://yandex.ru/maps/?ll=37.62,55.75&z=12">Open the map of
        Moscow in the web version of Yandex Maps</a>

For the list of available parameters, see the Web section.

When you open the link on mobile devices, the system may suggest opening the link in the installed app. On computers, the link opens in a browser.