Access API: Device Orientation

This API uses information sent from the device’s accelerometer to inform your code of the current orientation of the device. This is triggered automatically by the app on page load and after any change in the device’s orientation.

Callbacks

Related Settings

Requirements:

  • Access JavaScript API
    • By Import - recommended, works both online & offline, requires inclusion of kiosk_functions.js prior to any of the following calls.
    • By Injection - only works offline, may not be available 'onload' event.

Sample Code

This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.  

To run sample code, set the app's homepage to  http://www.kioskproapp.com/device-orientation

Download Sample Code


kp_Device_didRotateToOrientation

This callback is triggered by the app on page load and after any change in the device's orientation.

Format
kp_Device_didRotateToOrientation(deviceOrientationInDegrees);
		
Parameters
  • deviceOrientationInDegrees = The orientation of the device in degrees. Possible values are:
    • 0 = portrait mode, with the Home button on the bottom.
    • 90 = landscape mode, with the Home button on the left.
    • -90 = landscape mode, with the Home button on the right.
    • 180 = portrait mode, with the Home button at the top.

Still stuck? How can we help? How can we help?