Search code examples
androidgoogle-chromedevicesensorsmotion

DeviceMotion on Android Chrome


Is there some kind of prefix for the JavaScript DeviceMotionEvent in the Chrome browser for Android?

Firefox Mobile supports it, but Chrome doesn't (tested on Xperia S and Nexus 4).

Here's the code i use:

if (window.DeviceMotionEvent) {
    window.addEventListener('devicemotion', deviceMotionHandler, false);
} else {
    $( "#divid" ).text( "DeviceMotion NOT supported" );
}

Chrome Version: 29.0.1547.72
Firefox Version: 24.0
Android Version: 4.3 (Nexus 4) and 4.1 (Xperia S)

PS: DeviceOrientationEvent is working well in Chrome and Firefox Mobile


Solution

  • Just found a way to get it to work:

    I downloaded the Beta Version of Chrome (30.0.1599.81) for Android. The DeviceMotion event is supported there.