offDeviceMotionChange不进回调
发布于 4 年前 作者 na76 14895 次浏览 来自 官方Issues
  startDeviceMotionDetect() {
    console.log('start device motion detect')
    wx.startDeviceMotionListening({
      interval: 'game',
      success: ()=>{
        console.log('device motion started succeed') 
      },
      fail: (err)=>{
        console.log('device motion started failed')
        console.log(err)
      },
    })
  },

  stopDeviceMotionDetect() {
    wx.stopDeviceMotionListening({
      success: (res) => {
        console.log('device motion detect stopped succeed')
      },
      fail: (err)=>{
        console.log('device motion stopped failed: ' + err)
      },
    })
  },

  endDeviceMotionDetect() {
    console.log('triggle offDeviceMotionChange')
    wx.offDeviceMotionChange(()=>{
      // 进不了这个回调
      console.log('offDeviceMotionChange Callback')
    })
  },

  onLoad() {
    wx.onDeviceMotionChange((result) => {
      console.log(result)
    })
  }

offDeviceMotionChange的回调无法正常触发

回到顶部