API: Return Screen 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.

Requirements

Kiosk Pro Basic, Plus and Enterprise

  • Integration of our JavaScript API into your webpage
    • Sample code to run within the app and download for integration into your own project is available here.
    • Best practices for working with the JavaScript API are available here.
  • App Settings
    • Content > JavaScript API > Access JavaScript API = By Import


Notifications via API Callbacks

On Screen Orientation Change or Page Load

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 - [string] the orientation of the device in degrees. Possible values are:
    • 0 - portrait mode with the Home button &/or port on the bottom
    • 90 - landscape mode with the Home button &/or port on the left
    • -90 - landscape mode, with the Home button &/or port on the right
    • 180 - portrait mode, with the Home button &/or port at the top


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 kioskgroup.com/screen-orientation-api
  • To download a .zip of sample code, click here.

Change Log

  • Added in version 5.4

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