The app-side map module encapsulates the mainstream three-party map SDK in the market, and provides JS API to call Android and iOS native map functions uniformly.

Project Type API
5+App/Wap2App plus.maps.*

Tip: App module configuration can only take effect after submitting the cloud package. Please use the [custom base] when running and debugging the real machine (http://ask.dcloud.net.cn/article/35115)

注意

  • 使用高德地图、百度地图需要商业授权,详情参考 商业授权相关说明
  • Only nvue pages in the uni-app project support the use of native SDK
  • The uni-app project temporarily does not support the use of Baidu Maps

# 高德地图

# 申请高德地图Key

使用前需到高德开放平台创建应用并申请Key

  • 登录 高德开放平台,进入“控制台”,如果没有注册账号请先根据页面提示注册账号
  • Open the "App Management" -> "My Apps" page, click "Create New App", and fill in the content to create an app according to the page prompts
  • Click "Add" under the application to add a key to the application, and apply for a key for the Android platform and iOS platform as required

# 配置使用高德地图

# 参数说明

  • 高德用户名 高德开放平台注册账号的用户名,获取方式参考“高德开放平台用户名”章节
  • appkey_android 高德开放平台申请的Android平台Key
  • appkey_ios iOS platform Key applied for by AutoNavi Open Platform

Notice

  • The HBuilderX standard base uses the AutoNavi Map SDK by default, and you can run the test directly on the real machine. At this time, the configured application package name and signature information will not take effect. Before the official release, please submit the cloud package or use the [custom debugging base](https 😕/ask.dcloud.net.cn/article/35115) test
  • Local offline packaging reference [Android platform AutoNavi map module configuration](https://nativesupport.dcloud.net.cn/AppDocs/usemodule/androidModuleConfig/map?id=%e9%ab%98%e5%be%b7% e5%9c%b0%e5%9b%be), [iOS Platform AutoNavi Map Module Configuration](https://nativesupport.dcloud.net.cn/AppDocs/usemodule/iOSModuleConfig/map?id=%e9%ab% 98%e5%be%b7%e5%9c%b0%e5%9b%be)

# 高德开放平台用户名

# 百度地图

# 申请百度地图Key

使用前需到百度开放平台创建应用并申请Key

  • 登录 百度开放平台,进入“控制台”,如果没有注册账号请先根据页面提示注册账号
  • Open the "App Management" -> "My Apps" page, click "Create App", and fill in the contents according to the page prompts to create an app to get the Key

# 配置使用百度地图

# 参数说明

  • appkey_android 百度地图开放平台申请的Android平台Key
  • appkey_ios The iOS platform key applied for by Baidu Maps Open Platform

Notice

  • HBuilderX standard base does not contain Baidu map, please use custom debugging base to test after configuration
  • Local offline packaging reference [Android platform Baidu map module configuration](https://nativesupport.dcloud.net.cn/AppDocs/usemodule/androidModuleConfig/map?id=%e7%99%be%e5%ba%a6%e5 %9c%b0%e5%9b%be), [iOS platform Baidu map module configuration](https://nativesupport.dcloud.net.cn/AppDocs/usemodule/iOSModuleConfig/map?id=%e7%99%be% e5%ba%a6%e5%9c%b0%e5%9b%be)

# Google Maps (Google Maps/google map)

Added support for HBuilderX 3.4.0+

# 申请Google地图Key

使用前需到Google地图开放平台创建应用并申请APIKey

  • 登录 Google地图开放平台,如果没有注册账号请先根据页面提示注册账号
  • 根据页面提示新建项目,也可以选择已经存在的项目
  • 打开“凭证”页面,点击 “创建凭证” -> “API密钥”获取APIKey,由于Google地图需要收费,为了保证安全建议配置限制密钥
    • Android平台 在“应用限制”下勾选“Android应用”,并添加绑定“软件包名称”、“SHA-1证书指纹”;在“API限制”下建议勾选“不限制密钥”
    • iOS平台 在“应用限制”下勾选“iOS应用”,并添加绑定“软件包ID”;在“API限制”下建议勾选“不限制密钥”

# 配置使用Google地图

# 参数说明

  • APIKey_android Google地图开放平台申请的Android平台APIKey
  • APIKey_ios iOS platform APIKey applied for by Google Maps Open Platform

Notice

  • Google Maps on Android and iOS platform SDK does not support POI search, and cannot directly use uni.chooseLocation(OBJECT), you can apply for Web Server APIKey performs POI search on the business server side, and implements chooseLocation related functions on the App side
  • HBuilderX standard base does not include Google map, please use custom debugging base to test after configuration