Appearance
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 landscapeLeft
.
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 landscapeLeft
:
Dart
try {
LicenseDetails licenseDetails = LicenseDetails("<ENTER_YOUR_LICENSE_KEY>");
Session? session = await FaceSessionBuilder()
.withDeviceOrientation(DeviceOrientation.landscapeLeft)
.withSessionInfoListener(this)
.withVitalSignsListener(this)
.withImageDataListener(this)
.build(licenseDetails);
} on HealthMonitorException catch(e) {
print("Received Error. Domain: ${e.domain} Code: ${e.code}");
}
The SDK defines the possible device orientations as an enum:
Dart
enum DeviceOrientation {
portrait, //The power charging port is facing down
portraitUpsideDown, //The power charging port is facing up
landscapeLeft, //The power charging port is facing left
landscapeRight //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.