Intel® XDK Simple Accelerometer Sample

The source code for this sample can be found here: or download the Intel® XDK to check out all the HTML5 Samples.


The accelerometer demonstration is a very simple implementation of how the intel.xdk JavaScript Bridge Library can be used to read a device's accelerometer data in a hybrid app.

Source Code

The initial event thrown when the intel.xdk library loads calls an event handler that includes this command. This command makes the device start reading accelerometer data and throwing JavaScript events to relay the results back to the HTML5.

This function handles the events thrown by the device relaying accelerometer information back to the HTML5. This function uses a simple CSS3 transformation to rotate the arrow image to align it with the current accelerometer reading.

Use the Accelerometer portion of the XDK to test this sample application in the simulator.


This sample application has been tested on a variety of iOS and Android devices.


On an iOS device, the operating system will flip any application if the device is held upside down. While this could be helpful for any user who might not know how to hold their device properly, it can be frustrating for an accelerometer demo app such as this one.

Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.
Возможность комментирования русскоязычного контента была отключена. Узнать подробнее.