- Print
- PDF
URL Scheme for integration of Maps app
- Print
- PDF
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:
Components | Description | Requirement status |
---|---|---|
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 SchemeapplicationId | 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.
- Create
LSApplicationQueriesSchemes
in info.plist and add the nmap.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>nmap</string>
</array>
- 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:
- Display main map
- Search map
- Display marker
- Find route
- Navigation
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
Parameters | Type | Requirement status | 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 | Zoom level 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:
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:
Integrated search
Shows the map search results according to the search keyword.
Action path
/search
Parameters
Parameters | Type | Requirement status | 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:
Search bus
Shows the bus search results according to the search keyword.
Action path
/search/bus
Parameters
Parameters | Type | Requirement status | 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:
Display marker
Displays a marker at the specified coordinates.
Action path
/place
Parameters
Parameters | Type | Requirement status | 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.
The call result is as follows:
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.
The call result is as follows:
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.
The call result is as follows:
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.
The call result is as follows:
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.
The call result is as follows:
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.
The call result is as follows:
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:
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.
The call result is as follows:
Common route search parameters
Common parameters used in route search (/route
) and navigation (/navigation
).
Parameters | Type | Requirement status | 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 |