아이러브커피
OWENCOUTTS
Walking in the clouds...

Accelerometer Events

How do we detect that our devices are moving in our web browser? It turns out that modern web browsers have two ways of doing it depending on what type of sensor your device has.

The above box uses the DeviceOriendationEvent. This is the standard and more accurate way of detecting acceleration data. It is meant to only be fired with acceleration can be decoupled from gravity (devices where there is an gyroscope such as a phone).

The above code uses the DeviceMotionEvent to get acceleration data. This event is fired on devices with acceleration data but no gyroscope data. The sensors the event uses are often used for protecting moving storage devices (such as a laptop with a hard drive).