May 19, 2021 WeChat Mini Program Development Document
Base library 2.8.1 starts to support, and low versions need to be compatible.
Listening for real-time geo-location change events needs to be used in conjunction with wx.startLocationUpdate, wx.startLocationUpdate.
A callback function for real-time geo-change events
Property | Type | Description | The lowest version |
---|---|---|---|
latitude | number | Latitudes, ranging from -90 to 90, with negative numbers representing south latitudes | |
longitude | number | Longe longs, ranging from -180 to 180, with negative numbers representing the western long term | |
speed | number | Speed, unit m/s | |
accuracy | number | The accuracy of the position | |
altitude | number | Height, unit m | 1.2.0 |
verticalAccuracy | number | Vertical accuracy, unit m (Android can't get, return 0) | 1.2.0 |
horizontalAccuracy | number | Horizontal accuracy, unit m | 1.2.0 |
const _locationChangeFn = function(res) {
console.log('location change', res)
}
wx.onLocationChange(_locationChangeFn)
wx.offLocationChange(_locationChangeFn)
Base library 2.8.1 starts to support, and low versions need to be compatible.
Cancel listening for real-time geo-location change events
A callback function for real-time geo-change events