URL Scheme for integration of Maps app
    • PDF

    URL Scheme for integration of Maps app

    • PDF

    Article Summary

    Available in Classic and VPC

    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

    ComponentsDescriptionRequirement status
    nmap://URL Scheme to access NAVER MapsRequired
    actionPathCall actionRequired
    parameter=valueInput parameters and input values according to the call actionVaries depending on the action. For more information, see Using URL Scheme.
    appnameIdentifying 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, 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

    The following example code calls queryIntentActivities to check if the NAVER Maps app is installed, and if not, redirects 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. The following code calls canOpenURL to check if the NAVER Maps app is installed, and if not, redirects 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.

    <script>
    function openNaverMapApp(url) {
        var clickedAt = +new Date();
    
        location.href = url;
    
        setTimeout(function() {
            if (+new Date() - clickedAt < 2000) {
                location.href = 'http://itunes.apple.com/app/id311867728?mt=8';
            }
        }, 1500);
    }
    
    window.onload = function() {
        openNaverMapApp("nmap://actionPath?parameter=value&appname={YOUR_APP_NAME}");
    };
    </script>
    

    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
    

    Parameters

    ParametersTypeRequirement statusDescription
    latdoubleNLatitude of the center of the map
    -Input value: 31.4344.35
    -Default value: retains the app's existing state
    lngdoubleNLongitude of the center of the map
    -Input value: 122.37132.00
    -Default value: retains the app's existing state
    zoomdoubleNZoom level of the map
    -Input value: 420
    -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
    

    Parameters

    ParametersTypeRequirement statusDescription
    querystringYSearch 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
    

    Parameters

    ParametersTypeRequirement statusDescription
    querystringYBus 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
    

    Parameters

    ParametersTypeRequirement statusDescription
    latdoubleYLatitude
    -Input value: 31.4344.35
    lngdoubleYLongitude
    -Input value: 122.37132.00
    namestringYName
    -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
    

    Parameters

    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
    

    Parameters

    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
    

    Parameters

    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
    

    Parameters

    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
    

    Parameters

    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).

    ParametersTypeRequirement statusDescription
    slatdoubleNDeparture latitude
    -Input value: 31.4344.35
    -Default value: uses user's current location
    slngdoubleNDeparture longitude
    -Input value: 122.37132.00
    -Default value: uses user's current location
    snamestringNDeparture name
    -Input value: URL encoded string
    -Default value: uses user's current location
    dlatdoubleYDestination latitude
    -Input value: 31.4344.35
    dlngdoubleYDestination longitude
    -Input value: 122.37132.00
    dnamestringNDestination name
    -Input value: URL encoded string
    -Default value: displays the destination address
    v1latdoubleNWaypoint 1 latitude
    -Input value: 31.4344.35
    -Default value: no waypoint
    v1lngdoubleNWaypoint 1 longitude
    -Input value: 122.37132.00
    -Default value: no waypoint
    v1namestringNWaypoint 1 name
    -Input value: URL encoded string
    -Default value: no waypoint
    v2latdoubleNWaypoint 2 latitude
    -Input value: 31.4344.35
    -Default value: no waypoint
    v2lngdoubleNWaypoint 2 longitude
    -Input value: 122.37132.00
    -Default value: no waypoint
    v2namestringNWaypoint 2 name
    -Input value: URL encoded string
    -Default value: no waypoint
    v3latdoubleNWaypoint 3 latitude
    -Input value: 31.4344.35
    -Default value: no waypoint
    v3lngdoubleNWaypoint 3 longitude
    -Input value: 122.37132.00
    -Default value: no waypoint
    v3namestringNWaypoint 3 name
    -Input value: URL encoded string
    -Default value: no waypoint
    v4latdoubleNWaypoint 4 latitude
    -Input value: 31.4344.35
    -Default value: no waypoint
    v4lngdoubleNWaypoint 4 longitude
    -Input value: 122.37132.00
    -Default value: no waypoint
    v4namestringNWaypoint 4 name
    -Input value: URL encoded string
    -Default value: no waypoint
    v5latdoubleNWaypoint 5 latitude
    -Input value: 31.4344.35
    -Default value: no waypoint
    v5lngdoubleNWaypoint 5 longitude
    -Input value: 122.37132.00
    -Default value: no waypoint
    v5namestringNWaypoint 5 name
    -Input value: URL encoded string
    -Default value: no waypoint

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.