Intel® XDK Orientation Sample

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


The orientation demonstration app is a very simple implementation of how the intel.xdk JavaScript Bridge Library can be used to sense a device's orientation in a hybrid app and react accordingly.

Source Code

The application sets an event handler to listen for orientation changes. Once the JavaScript bridge library is loaded (in this case intelxdk.js) the application will start throwing a JavaScript event named intel.xdk.device.orientation.change whenever there is an orientation change.
The intel.xdk.device.orientation.change event passes an object that includes information about the device's orientation. Valid values are expressed in ninety degree increments (i.e. -90,0,90,180).

Alter the orientation of the simulated device in the XDK using the Devices panel pictured here.


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


Since it relies on the Intel XDK JavaScript Bridge, this application will only run appropriately as a hybrid application built for iOS or Android.
For more complete information about compiler optimizations, see our Optimization Notice.