Intel XDK Orientation Sample

The source code for this sample can be found here: https://github.com/gomobile/sample-orientation or download the Intel(R) XDK to check out all the HTML5 Samples.

Purpose

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.

Testing

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

Limitations