cocos creator 3.+ 设备重力感应问题(重力加速计不是物理感应)回调函数失效

onLoad () {

    input.setAccelerometerEnabled(true);

    input.on(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);

}

onDestroy () {

    input.off(Input.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);

}

onDeviceMotionEvent (event: EventAcceleration) {

    alert("a");

    console.log(event.acc.x + "   " + event.acc.y);

}

我是按照官方手册写的,但是我真机调试onDeviceMotionEvent函数怎么都不执行,请问什么原因?

ios或android的设备的传感器权限配置了吗

不确定,我看IOS好像是默认就开启了,找了台安卓机测试是没问题的。莫非就是权限配置?