Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top