Change device orientation (V1)
Display scanner devices such as MARK Display support changing the screen orientation depending on which hand the user holds the scanner in. This allows the displayed content to be rotated for improved readability and ergonomics.
Note
Note: On MARK Display orientation settings reset after each reboot or power cycle — for example, when removing the scanner from the charger.
Checking display availability
Before changing the screen orientation, verify that the connected device supports a display by calling:
PgManager.isDisplayAvailable()
This ensures that the orientation command is only sent to compatible devices.
Changing the screen orientation
To change the device’s display orientation, call changeScreenOrientation() from the PgManager. This method requires a PgCommand containing a PgOrientation.V1 value, which specifies the desired orientation.
PgCommandParams() is optional and can define command behavior (for example, queue handling).
The available orientation options are:
Option | Description |
|---|---|
| Sets the display to portrait orientation. |
| Rotates the display to right landscape orientation. |
| Rotates the display to left landscape orientation. |
Define the IPgCommandResult callback to handle the command response:
onSuccess()– Called when the orientation change is successful.onError(error: PgError)– Called if the orientation cannot be changed.
Example:
PgManager.changeScreenOrientation(
command = PgCommand(
commandData = PgOrientation.V1.PORTRAIT,
commandParams = PgCommandParams()
),
callback = object : IPgCommandResult {
override fun onSuccess() {
// Handle successful orientation change
}
override fun onError(error: PgError) {
// Handle error if orientation change fails
}
}
)Best Practices
Implement a reconnect handler to automatically reapply preferred orientation when the scanner reconnects.
Avoid changing orientation repeatedly in short intervals to prevent performance degradation.