I have the following script on a web page:
window.addEventListener('deviceorientation', function(event) { // Get Euler angles from device var alpha = 360 - event.alpha; var beta = event.beta; var gamma = event.gamma; // Display Euler angles document.getElementById("alpha").innerHTML = alpha; document.getElementById("beta").innerHTML = beta; document.getElementById("gamma").innerHTML = gamma; }, false);
This works great in a browser like mobile Firefox for Android. It displays my title, step and roll in relation to the coordinates of the Earth (alpha is always 0 when pointing to the north, beta is always 90 when keeping the device vertical, etc.).
Now I load the same script into the PhoneGap application using WebView and it does not display anything. How to get these values โโin PhoneGap without having to completely recreate the merge from scratch?
source share