javascripthtmlmicrosoft-edgedevicemotion

devicemotion event on edge browser


I am trying to get rotationrate from the devicemotion event of HTML5 spec

I am able to retrieve the value on chrome and iOS. However the value seems to be null on edge browser. Am I doing something wrong - My code is as follows

window.addEventListener('devicemotion', updateM, false);

var updateM = function(e){
    console.log(e.rotationRate); // returns null on edge 
}

MSDN spec says it is available on IE 11 and higher - https://msdn.microsoft.com/en-us/library/dn342897(v=vs.85).aspx

Just in case anyone want to try on the phone directly : http://jsfiddle.net/q5z4ytvf/


Solution

  • I did not realize it is not a software problem but rather a hardware problem. I was using lumia 640 and that device doesn't have a gyroscope. I hope this comes in handy to someone.