Is the bearing returned by the accelerometer the way to go, or it's better to use the one GPS service returns?

有帮助吗?

解决方案

Accelerometer + magnetic sensor is definitely the way to go. GPS service does not return bearing if the device is static. The getBearing() method only returns something if the device is moving. As stated in the documentation, hasBearing() typically returns false.

In fact, the word bearing is quite dangerous when used in these contexts, because the bearing from the accelerometer is understandable as the direction the device is facing, while the bearing from the GPS service is the direction alongside the device is moving.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top