tt.onLocationChangeError
基础库 2.48.0 开始支持本方法,低版本需做兼容处理,这是一个同步方法。
注册位置更新异常回调。
语法
tt.onLocationChangeError(callback)
参数说明
callback
类型 | 默认值 | 必填 | 说明 | 最低支持版本 |
---|---|---|---|---|
function | 是 | 回调函数 | 2.48.0 |
回调函数参数说明
object 类型,属性如下:
属性名 | 类型 | 说明 | 最低支持版本 |
---|---|---|---|
errMsg | string | 错误信息 | 2.48.0 |
返回值
无
扫码体验
请使用字节宿主APP扫码
代码示例
// 在地理位置监听过程中,定位权限被关闭或其他异常情况,会触发onLocationChangeError事件
tt.onLocationChangeError((err) => {
console.log("onLocationChangeError: ", err);
});
tt.startLocationUpdate({
success(res) {
console.log("开启接收位置更新", res);
},
fail(res) {
console.log("开启接收位置更新失败", res);
},
});
Bug & Tip
- Tip:开发者工具暂不支持此能力,请用真机扫码调试。
点击纠错
该文档是否对你的开发有所帮助?
有帮助
没帮助
该文档是否对你的开发有所帮助?
有帮助
没帮助