Skip to content
On this page

Device Orientation

The SDK supports the setting of the device orientation in face measurement sessions. The orientation is determined by the application during the session creation and can be set according to the current device orientation at the time the session is created, or according to the preferred UI orientation.

The orientation is defined as the position of the native base of the device (also commonly known as the charging port location), relative to the device's current rotation. For example, if the device is rotated so its base is to the left of the user, then the orientation is defined as LANDSCAPE_LEFT.

The default device orientation is PORTRAIT. If any other orientation is requested, then it must be provided when creating a new measurement session.

In the following example, the device orientation is LANDSCAPE_LEFT:

TypeScript
import {
    DeviceOrientation, 
    SessionBuilder
} from 'binah-react-native-sdk';

try { 
    const session = await SessionBuilder.faceSession(
        {
            licenseKey: "<ENTER_YOUR_LICENSE_KEY>"
        },
        {
            deviceOrientation: DeviceOrientation.LANDSCAPE_LEFT
        }
    );
} catch (e) {
    const exception = (e as HealthMonitorException)
    console.log(`Error: ${exception?.code}`);
}

The SDK defines the possible device orientations as an enum:

TypeScript
export enum DeviceOrientation {
  PORTRAIT,             //The power charging port is facing down
  PORTRAIT_UPSIDE_DOWN, //The power charging port is facing up
  LANDSCAPE_LEFT,       //The power charging port is facing left
  LANDSCAPE_RIGHT       //The power charging port is facing right
}

When the device orientation differs from the requested orientation during a measurement, then:

  • The SDK will indicate that the image orientation is incorrect as part of ImageDataListener
  • Images with an incorrect orientation will not be processed by the SDK.