# startCompass ^6.8

罗盘监听

# 请求参数

  • N/A

# 接口调用示例


    this.$bridge
    .startCompass()
    .then(res => {    
        this.$alert(res)
    })
    .catch(err => {
        this.$toast(err)
    })

1
2
3
4
5
6
7
8
9
10

# 返回参数

  • 成功时返回
Prop Type Comment
code Number -
direction String 面对的方向度数
accuracy Number/String 精度

# 返回示例


{
    "code": 0,
    "direction": 335.1891784667
    "accuracy": 37.17823791503906
}

1
2
3
4
5
6
7

# FAQ

由于平台差异,accuracy 在 iOS/Android 的值不同

iOS:accuracy 是一个 number 类型的值,表示相对于磁北极的偏差。0 表示设备指向磁北,90 表示指向东,180 表示指向南,依此类推。
Android:accuracy 是一个 string 类型的枚举值
更新时间: 7/27/2021, 11:23:45 AM