# wx.onLocationChange(function callback)

Start from base library version 2.8.1. Please remaining backward compatible.

with Promise style call: Not supported

Mini Program plugin: Not supported

Monitor real-time geo-location change events in conjunction with wx.startLocationUpdateBackgroundwx.startLocationUpdateUse.

# parameter

# function callback

Callback function for real-time location-changing events

# parameter

# Object res
attribute type Introductions Minimum version
latitude number Latitude, range -9090. The negative number indicates latitude south. use gcj02 NBS coordinate system
longitude number Longitude, range -180Negative numbers denote west longitude. use gcj02 NBS coordinate system
speed number Speed, unit m/s
accuracy number Accuracy of position
altitude number Height, unit m 1.2.0
verticalAccuracy number Vertical accuracy, in units m(Android Unable to get, return 0) 1.2.0
horizontalAccuracy number Horizontal precision, unit m 1.2.0

# sample code

 const _locationChangeFn = function(res) {
  console.log('location change', res)
 }
 wx.onLocationChange(_locationChangeFn)
 wx.offLocationChange(_locationChangeFn)