Android: reading accelerometer without memory allocation?

前端 未结 2 1046
遇见更好的自我
遇见更好的自我 2021-02-09 14:35

I am developing a game for Android (2.1+), using the accelerometer as user input. I use a sensor listener that I register at the beginning of the activity with the sensor manage

2条回答
  •  梦毁少年i
    2021-02-09 15:01

    I believe this problem only occurs when there is more than one Sensor registered to a SensorEventListener. I think a workaround would be to use a different SensorEventListener per Sensor.

    Also make sure to NOT register the SAME Sensor with two different SensorEventListener -- there was a bug in that case that got fixed in Gingerbread.

    Another, less attractive, option would be to use the Gingerbread NDK, which doesn't have this issue.

    I hope this helps.

提交回复
热议问题