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函数怎么都不执行,请问什么原因?