Using Location.getBearing();
I seem to get randomly changing bearings.
Aka, I can turn the device around slowly and it wont notice, it just chooses its own random bearings.
I know the device is working, as the "You are here" icon in the Maps app on the tablet slowly rotates as I rotate the device.
Is there a different proper way of getting bearing? I am using the GPS. Maybe there is a better way to determine which direction you are facing.
Try to get bearing from Accelerometer sensor and Magnetic Field (G-) sensor.
Here's a tutorial: http://android-coding.blogspot.co.at/2012/03/create-our-android-compass.html
The Location.getBearing()
returns the bearing that the GPS satellites computed for you. It is not a real time representation of the heading of your device. The Google Maps app uses the device's built in G-sensors to get the direction you are facing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With