I'm trying to read absolute DeviceOrientation event values to create HTML5 compass Mobile Web App.
If I'm using this code, I can get alpha, beta and gamma values without a problem:
window.addEventListener('deviceorientation', function(event) {
alpha = event.alpha;
beta = event.beta;
gamma = event.gamma;
});
However, those values aren't helpful to me because I need to get absolute values to find exact position of North etc. I've found this article which explains how to use absolute values of event.
When I change code to this:
window.addEventListener('deviceorientationabsolute', function(event) {
alpha = event.alpha;
beta = event.beta;
gamma = event.gamma;
var absolute = event.absolute;
});
Alpha, beta and gamma values are set to null. This is strange to me, because event.absolute value is set to true. According to that, event values should be displayed.
Anyone has or had any similar problems? Any help would be appreciated; also if there is some working example of HTML5 Compass App it would be helpful to post it here.
Thank you in advance!