URL Scheme for integration of Maps app

Prev Next

Available in Classic and VPC

Note

Maps API service, which had been provided by NAVER Cloud Platform, has been upgraded and newly released. Use new Maps service with NAVER map content's customizing styling function added.

The NAVER Maps app URL Scheme allows the use of NAVER Maps features by calling the NAVER Maps app from a user's app or web page.

Syntax

The NAVER Maps app URL Scheme begins with nmap://, and the syntax format is as follows:

naverapp-urlscheme-syntax_ko

Components Description Required
nmap:// URL Scheme to access NAVER Maps Required
actionPath Call action Required
parameter=value Input parameters and input values according to the call action Varies depending on the action. For more information, see Using URL Scheme
appname Identifying string for the app or web page using the URL Scheme
  • Android app: app's applicationId
  • iOS app: app's bundle ID
  • Mobile web: web page URL
Required. All URLs must include a appname parameter.

Pre-setup

The NAVER Maps URL Scheme can only be used if the NAVER Maps app is installed on the user's device. If the NAVER Maps app is not installed, you must write a code to install the NAVER Maps app from the App Store or Google Play. The code that must be written for different environmental requirements (mobile app, mobile web, and in-app browser) is as follows:

Mobile app

The code to be written in the mobile app to use the NAVER Maps URL Scheme is as follows:

Android

As shown in the example code below, call queryIntentActivities to check if the NAVER Maps app is installed, and if not, go to Google Play.

String url = "nmap://actionPath?parameter=value&appname={YOUR_APP_NAME}";

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addCategory(Intent.CATEGORY_BROWSABLE);

List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (list == null || list.isEmpty()) {
    context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.nhn.android.nmap")));
} else {
    context.startActivity(intent);
}

iOS

The following code must be written in the iOS mobile app:

  1. Create LSApplicationQueriesSchemes in info.plist and add the nmap.
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>nmap</string>
</array>
  1. As shown in the example code below, call canOpenURL to check if the NAVER Maps app is installed, and if not, go to the App Store.
let url = URL(string: "nmap://actionPath?parameter=value&appname={YOUR_APP_NAME}")!
let appStoreURL = URL(string: "http://itunes.apple.com/app/id311867728?mt=8")!

if UIApplication.shared.canOpenURL(url) {
  UIApplication.shared.open(url)
} else {
  UIApplication.shared.open(appStoreURL)
}

Mobile web

To use the NAVER Maps URL Scheme on the mobile web, the NAVER Maps app must be installed.

Android

Using Intent URL automatically redirects to the Google Play Store if the app is not installed. The structure of the Intent URL is as follows:

intent://actionPath?parameter=value&appname={YOUR_APP_NAME}#Intent;scheme=nmap;action=android.intent.action.VIEW;category=android.intent.category.BROWSABLE;package=com.nhn.android.nmap;end

The following example displays the URL Scheme of "Jeongja-dong, Bundang-gu, Seongnam-si, Gyeonggi-do" marker at (37.4979502, 127.0276368) with Intent URL:

intent://place?lat=37.4979502&lng=127.0276368&name=%EA%B2%BD%EA%B8%B0%EB%8F%84%20%EC%84%B1%EB%82%A8%EC%8B%9C%20%EB%B6%84%EB%8B%B9%EA%B5%AC%20%EC%A0%95%EC%9E%90%EB%8F%99&appname=com.example.myapp#Intent;scheme=nmap;action=android.intent.action.VIEW;category=android.intent.category.BROWSABLE;package=com.nhn.android.nmap;end

iOS

Use the following method on a web page using a JavaScript timer to branch to the App Store:


In-app browser

To use the URL Scheme in an in-app browser, you need to add a URL Scheme processing code as follows:

Android

The following code overrides shouldOverrideUrlLoading of WebViewClient to add a URL Scheme processing code:

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (url.startsWith("intent:")) {
        Intent intent;
        try {
            intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
        } catch (URISyntaxException e) {
            return false;
        }
        if (TextUtils.isEmpty(intent.getPackage())) {
            return false;
        }
        List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
        if (list == null || list.isEmpty()) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + intent.getPackage())));
        } else {
            startActivity(intent);
        }
        return true;
    }

    return false;
}

iOS

The following shows adding a URL Scheme processing code to decidePolicyFor of WKWebview:

func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
    if let url = navigationAction.request.url {
        if url.scheme == "nmap" {
            UIApplication.shared.open(url)
            decisionHandler(.cancel)
            return
        }
    }
    decisionHandler(.allow)
}

Using URL Scheme

This section describes the actions provided by the NAVER Maps app URL Scheme. Through this guide, you will learn how to use the following actions:

Note

For common parameters used in route finding (/route) and navigation (/navigation), see Route search common parameters of this article.

Display main map

Shows the main page of the NAVER Maps app.

Action path

/map

Parameter

Parameter Type Required Description
lat double N Latitude of the center of the map
  • Input value: 31.43-44.35
  • Default value: retains the app's existing state
lng double N Longitude of the center of the map
  • Input value: 122.37-132.00
  • Default value: retains the app's existing state
zoom double N Latitude of the center of the map
  • Input value: 4-20
  • Default value: retains the app's existing state

Usage examples

Display main map page
The following is an example of displaying the main page of the Maps app without input parameters:

nmap://map?&appname=com.example.myapp

The call result is as follows:

url-scheme-map-no-parameter_ko

Reflect the center coordinates and zoom level

The following is an example of displaying the main page of the Maps app by specifying the center point of the map to (37.4979502, 127.0276368) and the zoom level to 20:

nmap://map?lat=37.4979502&lng=127.0276368&zoom=20&appname=com.example.myapp

The call result is as follows:

url-scheme-map-parameter_ko

Integrated search

Shows the map search results according to the search keyword.

Action path

/search

Parameter

Parameter Type Required Description
query string Y Search keywords
  • Input value: URL encoded string

Usage examples

The following example is a map search with "Gangnam Station" as the search keyword:

nmap://search?query=%EA%B0%95%EB%82%A8%EC%97%AD&appname=com.example.myapp

The call result is as follows:

url-scheme-search-normal_ko

Search bus

Shows the bus search results according to the search keyword.

Action path

/search/bus

Parameter

Parameter Type Required Description
query string Y Bus number
  • Input value: URL encoded string

Usage examples

The following is an example of searching for bus number "222":

nmap://search/bus?query=222&appname=com.example.myapp

The call result is as follows:

url-scheme-search-bus_ko

Display marker

Displays a marker at the specified coordinates.

Action path

/place

Parameter

Parameter Type Required Description
lat double Y Latitude
  • Input value: 31.43-44.35
lng double Y Longitude
  • Input value: 122.37-132.00
name string Y Name
  • Input value: URL encoded string

Usage examples

The following is an example of displaying "Jeongja-dong, Bundang-gu, Seongnam-si, Gyeonggi-do" marker at (37.3677345,127.1083617) location:

nmap://place?lat=37.3677345&lng=127.1083617&name=%EA%B2%BD%EA%B8%B0%EB%8F%84%20%EC%84%B1%EB%82%A8%EC%8B%9C%20%EB%B6%84%EB%8B%B9%EA%B5%AC%20%EC%A0%95%EC%9E%90%EB%8F%99&appname=com.example.myapp

The call result is as follows:

url-scheme-place_ko

Find public transportation route

Performs a public transportation route search.

Action path

/route/public

Parameter

See the Route search common parameters section.

Usage examples

The following is an example of searching for a public transportation route from Seoul National University to Olympic Park:

nmap://route/public?slat=37.4640070&slng=126.9522394&sname=%EC%84%9C%EC%9A%B8%EB%8C%80%ED%95%99%EA%B5%90&dlat=37.5209436&dlng=127.1230074&dname=%EC%98%AC%EB%A6%BC%ED%94%BD%EA%B3%B5%EC%9B%90&appname=com.example.myapp

The call result is as follows:

url-scheme-route-public_ko

Find car route

Performs a car route search.

Action path

/route/car

Parameter

See the Route search common parameters section.

Usage examples

An example of finding car route from Seoul National University to Olympic Park

The following is an example of searching for a car route from Seoul National University to Olympic Park:

nmap://route/car?slat=37.4640070&slng=126.9522394&sname=%EC%84%9C%EC%9A%B8%EB%8C%80%ED%95%99%EA%B5%90&dlat=37.5209436&dlng=127.1230074&dname=%EC%98%AC%EB%A6%BC%ED%94%BD%EA%B3%B5%EC%9B%90&appname=com.example.myapp

The call result is as follows:

url-scheme-route-car-1_ko

An example of finding car route with a waypoint

The following is an example of searching for a car route from Green Factory, via Seoul National University, to Seongnam City Hall:

nmap://route/car?slat=37.3595953&slng=127.1053971&sname=%EA%B7%B8%EB%A6%B0%ED%8C%A9%ED%86%A0%EB%A6%AC&secoords=37.359761,127.10527&dlng=127.1267772&dlat=37.4200267&dname=%EC%84%B1%EB%82%A8%EC%8B%9C%EC%B2%AD&decoords=37.4189564,127.1256827&v1lng=126.9522394&v1lat=37.464007&v1name=%20%EC%84%9C%EC%9A%B8%EB%8C%80%ED%95%99%EA%B5%90&v1ecoords=37.466358,126.948357&appname=com.example.myapp

The call result is as follows:

url-scheme-route-car-2_ko

Find walking route

Performs a walking route search.

Action path

/route/walk

Parameter

See the Route search common parameters section.

Usage examples

The following is an example of searching for a walking route from Seoul National University to Dongwon Naksungdae Apartment:

nmap://route/walk?slat=37.4640070&slng=126.9522394&sname=%EC%84%9C%EC%9A%B8%EB%8C%80%ED%95%99%EA%B5%90&dlat=37.4764356&dlng=126.9618302&dname=%EB%8F%99%EC%9B%90%EB%82%99%EC%84%B1%EB%8C%80%EC%95%84%ED%8C%8C%ED%8A%B8&appname=com.example.myapp

The call result is as follows:

url-scheme-route-walk_ko

Find bicycle route

Performs a bicycle route search.

Action path

/route/bicycle

Parameter

See the Route search common parameters section.

Usage examples

The following is an example of searching for a bicycle route from Seoul National University to Olympic Park:

nmap://route/bicycle?slat=37.4640070&slng=126.9522394&sname=%EC%84%9C%EC%9A%B8%EB%8C%80%ED%95%99%EA%B5%90&dlat=37.5209436&dlng=127.1230074&dname=%EC%98%AC%EB%A6%BC%ED%94%BD%EA%B3%B5%EC%9B%90&appname=com.example.myapp

The call result is as follows:

url-scheme-route-bicycle_ko

Navigation

Searches for a navigation route.

Action path

/navigation

Parameter

See the Route search common parameters section.

Usage examples

Safe driving mode navigation

The following is an example of displaying the navigation page in safe driving mode:

nmap://navigation?&appname=com.example.myapp

The call result is as follows:

url-scheme-navi-1_ko

Navigation from current location to destination

The following is an example of searching for a navigation route from the user's current location to Olympic Park:

nmap://navigation?dlat=37.5209436&dlng=127.1230074&dname=%EC%98%AC%EB%A6%BC%ED%94%BD%EA%B3%B5%EC%9B%90&appname=com.example.myapp

The call result is as follows:

url-scheme-navi-2_ko

Common route search parameters

Common parameters used in route search (/route) and navigation (/navigation).

Parameter Type Required Description
slat double N Departure latitude
  • Input value: 31.43-44.35
  • Default value: uses user's current location
slng double N Departure longitude
  • Input value: 122.37-132.00
  • Default value: uses user's current location
sname string N Departure name
  • Input value: URL encoded string
  • Default value: uses user's current location
dlat double Y Destination latitude
  • Input value: 31.43-44.35
dlng double Y Destination longitude
  • Input value: 122.37-132.00
dname string N Destination name
  • Input value: URL encoded string
  • Default value: displays the destination address
v1lat double N Waypoint 1 latitude
  • Input value: 31.43-44.35
  • Default value: no waypoint
v1lng double N Waypoint 1 longitude
  • Input value: 122.37-132.00
  • Default value: no waypoint
v1name string N Waypoint 1 name
  • Input value: URL encoded string
  • Default value: no waypoint
v2lat double N Waypoint 2 latitude
  • Input value: 31.43-44.35
  • Default value: no waypoint
v2lng double N Waypoint 2 longitude
  • Input value: 122.37-132.00
  • Default value: no waypoint
v2name string N Waypoint 2 name
  • Input value: URL encoded string
  • Default value: no waypoint
v3lat double N Waypoint 3 latitude
  • Input value: 31.43-44.35
  • Default value: no waypoint
v3lng double N Waypoint 3 longitude
  • Input value: 122.37-132.00
  • Default value: no waypoint
v3name string N Waypoint 3 name
  • Input value: URL encoded string
  • Default value: no waypoint
v4lat double N Waypoint 4 latitude
  • Input value: 31.43-44.35
  • Default value: no waypoint
v4lng double N Waypoint 4 longitude
  • Input value: 122.37-132.00
  • Default value: no waypoint
v4name string N Waypoint 4 name
  • Input value: URL encoded string
  • Default value: no waypoint
v5lat double N Waypoint 5 latitude
  • Input value: 31.43-44.35
  • Default value: no waypoint
v5lng double N Waypoint 5 longitude
  • Input value: 122.37-132.00
  • Default value: no waypoint
v5name string N Waypoint 5 name
  • Input value: URL encoded string
  • Default value: no waypoint