Horizontal compass heading not working
Hi, i've been using this plugin to get the absolute north point.
There is some problem with it. When using navigator.compass.getCurrentHeading(console.log);
If the phone is in portrait mode there is no problem...the value goes from 0 to 359.99
But when the phone is in landscape mode the values are totally wrong and not stable at all,
varying almost +/-20 degrees... Soo, how to get the right value?
Orientation | Degrees | Degrees |
----------------------------------
Portrait | 0 | 45 |
Landscape | 20 | 80 |
UpsideDown | 160 | 220 |
Landscape | 190 | 350 |
I'm not an Android developer but i think that it could be fixed by implementing SensorManager.remapCoordinateSystem I will try my best to fix it.
Yep, it works. Gotta add the device orietation check to use the right axis while remapping.
@StarStep what is the current status of this bug? I've been looking across cordova/xamarin/react native packages for an implementation on Android that works in landscape mode and I have yet to find one.
I'm working on another project... sorry. I dont know if it was fixed. You could try to test it and confirm for yourself better. My test code was something like this:
function show(text) { document.body.innerHTML = text; }
function updatePosition() {
navigator.compass.getCurrentHeading(function(heading) {
show(JSON.stringify(heading, null, 2));
}, function() {
show("Heading not available");
});
}
setInterval(updatePosition, 1000);
Has there been any progress on this? i have an application that we'd like to get compass directions for both landscape and portrait.
I had the same problem ... then the deviation was caused by the magnetic case of the tablet