问题
As I know, the most of android devices allows to detect rotation by accelerometer, but I've noticed, that it doesn't detect rotation parallel to the ground. For example, if I put the device on a table and turn it around, no one of accelerometer indicators doesn't change.
At the picture, it's called "alfa" rotation. So how can I detect this kind of turning?
回答1:
For sensing rotation around z-axis you need to implement a compass function. A good tutorial is this one. To make the resulting values more stable you need to implement some algorithm which smoothes your incoming data (averages over a queue of data, filtering outliers, etc.). Here is a good overview.
来源:https://stackoverflow.com/questions/38244405/how-to-detect-android-device-rotation-parallel-to-the-ground