小程序 - registerOpenLocationEventHandler

WMPFMiniProgramApi.registerOpenLocationEventHandler

需 WMPF >= 2.1.0 支持,使用前建议阅读注意事项

注册 wx.openLocation 回调。

  • 回调将在小程序调用 wx.openLocation 时被调用,可用于车机系统弹出地图页面,并显示具体的地理位置信息。
  • 可以使用 WMPFMiniProgramApi.unregisterOpenLocationEventHandler 反注册。

调用参数

参数 类型 说明 最低版本
handler AbstractOnOpenLocationEventHandler wx.openLocation 回调

返回参数

示例代码

val miniProgramApi = WMPF.getInstance().getMiniProgramApi()
miniProgramApi.registerOpenLocationEventHanlder(object : AbstractOnOpenLocationEventHandler {
    override fun onInvoke(data: WMPFOpenLocationData, callback: IPCInvokeCallback<IPCVoid>) {
        // 在这里拉起系统地图页面
        callback.onCallback(IPCVoid())
    }
})
posted on 2025-02-22 13:26  AtlasLapetos  阅读(5)  评论(0)    收藏  举报