wechat/location

location module provides location API bindings details in wechat document

Values

pub fn choose_location(
  latitude lat: Float,
  longitude lon: Float,
  complete cb: fn() -> Nil,
) -> promise.Promise(Result(object.JsObject, object.WechatError))

wx.chooseLocation Open map to select location

pub fn choose_poi(
  latitude lat: Float,
  longitude lon: Float,
  complete cb: fn() -> Nil,
) -> promise.Promise(Result(object.JsObject, object.WechatError))

wx.choosePoi Open POI selection page for user to select nearby point of interest

pub fn get_fuzzy_location(
  of_type t: String,
  complete cb: fn() -> Nil,
) -> promise.Promise(Result(object.JsObject, object.WechatError))

wx.getFuzzyLocation Get approximate location without requiring user authorization

pub fn get_location(
  altitude a: Bool,
  complete cb: fn() -> Nil,
) -> promise.Promise(Result(object.JsObject, object.WechatError))

wx.getLocation Get current geographic location

pub fn off_location_change(
  callback cb: fn(object.JsObject) -> Nil,
) -> Nil

wx.offLocationChange Remove location change event listener

pub fn off_location_change_error(
  callback cb: fn(object.JsObject) -> Nil,
) -> Nil

wx.offLocationChangeError Remove location change error event listener

pub fn on_location_change(
  callback cb: fn(object.JsObject) -> Nil,
) -> Nil

wx.onLocationChange Listen for location change events

pub fn on_location_change_error(
  callback cb: fn(object.JsObject) -> Nil,
) -> Nil

wx.onLocationChangeError Listen for location change error events

pub fn open_location(
  latitude lat: Float,
  longitude lon: Float,
  scale s: Int,
  name n: String,
  address a: String,
  complete cb: fn() -> Nil,
) -> promise.Promise(Result(object.JsObject, object.WechatError))

wx.openLocation Use built-in map to view location

pub fn start_location_update(
  of_type t: String,
  complete cb: fn() -> Nil,
) -> promise.Promise(Result(object.JsObject, object.WechatError))

Phase 20: Location Advanced

wx.startLocationUpdate Enable mini-program to receive location messages when in foreground

pub fn start_location_update_background(
  of_type t: String,
  complete cb: fn() -> Nil,
) -> promise.Promise(Result(object.JsObject, object.WechatError))

wx.startLocationUpdateBackground Enable mini-program to receive location messages in foreground and background

pub fn stop_location_update(
  complete cb: fn() -> Nil,
) -> promise.Promise(Result(object.JsObject, object.WechatError))

wx.stopLocationUpdate Stop listening for real-time location changes

Search Document