# Location Service Usage Guide

# I. Notice Before Use

Map and Location Services Related in Multiterminal Applications JSAPI Capacity, such asMap assemblywx.openLocation etc. location Related interface capabilities, is based on theTencent Location ServicesService implementation, developers need to go to the Tencent location services console to register a developer account, and create a corresponding to get LBS SDK Required Key。 To help developers better understand the overall logic, read this section carefully:

  • First, go toTencent Location ServicesConsole to register a developer account, and create an app to get LBS SDK Required Key
  • Then, configure the Enable in the Developer ToolsLBS SDK, and fill in the corresponding Key
  • Finally, in JS The code side uses the call location Relevant JSAPI
  • This service is a free service of Tencent location services, but if you need a higher amount, you need to pay a withdrawal amount, details can be viewedDxplaination of Quota Restrictions
  • And, for commercial authorization can see the detailsTencent Location Services Commercialization Services

# 1. Regarding SDK Version requirements

  • iOS SDK: Version number required 1.0.14
  • Android SDK : Version number required 1.0.7

Added: Android Core sdk Choice 1.2.0 And above, Android Corresponding lbs sdk Also choose 1.2.0 And above, otherwise the build will fail.

# 2. About Compliance Guidelines

According to regulatory requirements, the use of SDK The end user must be notified in the Privacy Policy SDK Use purposes, and shall not initialize any of the End Users without their consent to the Privacy Policy SDK。 Please ensure that the app you develop or operate has a Privacy Policy text that complies with regulatory requirements. Please be sure to clearly inform end users that your application uses Tencent Location Services.

# 3、JSAPI list

LBS SDK, including capabilities such as maps, positioning, compass, accelerometer, and device orientationAmong them, maps and positioning capabilities need to be configured with Tencent location services Key, specifically related JSAPI The list is as follows:

name Function Dxplaination Whether to support
wx.stopLocationUpdate Turn off listening for real-time position changes, and both front and rear stations stop receiving messages Support
wx.startLocationUpdateBackground Open Mini Program into the background before receiving location messages, need to guide the user to openTo grant authorization Support
wx.startLocationUpdate Open the Mini Program to receive location messages when it enters the foreground Support
wx.openLocation Use WeChat's built-in map to view your location Support
wx.onLocationChangeError Monitor Persistent Location Interface Return Fails Trigger Support
wx.onLocationChange Monitor real-time geo-location changes in combination with wx.startLocationUpdateBackground、wx.startLocationUpdate use Support
wx.offLocationChangeError Remove persistent location interface Triggered when return fails Support
wx.offLocationChange Remove the listener function for real-time geolocation change events Support
wx.getLocation Get the current location, speed yesThis interface does not involve billing
wx.chooseLocation Open Map Select Location Support

Note

  • Use this ability to build IPA When not selectedProvisional signature, Must ChooseCertificate signature

# II. Operational Guidelines

The how-to guide in this section contains only the actions on the developer tools, more aboutTencent Location ServicesConsole operation can go to its official website to see the relevant guidelines

# 1. Application LBS SDK Key

Tencent Location Services Console to register a developer account and create a corresponding to get LBS SDK Required Key

  • Create the application, fill in the application name and application type
  • Add to Key
  • Need to be checked at the same timeWebServiceAPIandSDK, butDomain Name WhitelistDo not fill in the contents.
  • to hitAdd toYou can create success and view quota information
  • Go toMy appYou can see LBS SDK Required Key
  • Supplementary note: Certified as an enterprise developer can get a higher quota, details can go toTencent Location Services Console - Quota managementTo view

# 2. Enable LBS SDK And configure Key

  • Go to the WeChat Developer Tool and open project.miniapp.json And go into the expansion SDK Configuration, and enable LBS SDK as well as fill in qmapAPIKey
  • qmapAPIKey Is the step 1 Tencent Location Services Key
  • Other Notes: iOS. edition There is no need to choose SDK Version, simply configure the qmapAPIKey can then

# Common problem

# 1. iOS in wx.getLocation No callbacks?

Please check project.miniapp.json Is it configured correctly? iOS Information Access Permission Description in Geolocation Related Privacy Issues, in particularNSLocationWhenInUseUsageDescriptionAlt text

# 2. wx.chooseLocation The open page has been Loading Medium?

Please check that the permissions configuration in question 1 is complete, and then check qmapAPIKey Are there anyContact Us (explore)Keyword Input Hints Whether the amount of these two interfaces is normal? If there is no amount, you need to apply for the amount first. If the amount has been used, please increase the amount.