debug
The sos.management.debug API groups together methods for working with native debug mode and the on-screen console.
Some modern systems might require additional steps to enable the native debug mode. Please refer to the native debug documentation for more information.
Debug Management Capabilities
| Capability | Description |
|---|---|
SET_DEBUG | If the device can enable or disable the native debug mode. |
ON_SCREEN_CONSOLE | If the device can show the on-screen console. |
If you want to check if the device supports this capability, use sos.management.supports().
Methods
disable()
The enable() method disables the native debug mode.
disable(): Promise<void>;
Return value
A promise that resolves when the debug mode is disabled.
Example
await sos.management.debug.disable();
disableOnScreenConsole()
The disableOnScreenConsole() method hides the on-screen console.
When the setting changes, the device restarts the application shortly after the promise resolves.
disableOnScreenConsole(): Promise<void>;
Return value
A promise that resolves when the setting is saved.
Possible errors
If the device does not support the on-screen console.
Example
await sos.management.debug.disableOnScreenConsole();
enable()
The enable() method enables the native debug mode.
enable(): Promise<void>;
Return value
A promise that resolves when the debug mode is enabled.
Example
await sos.management.debug.enable();
enableOnScreenConsole()
The enableOnScreenConsole() method shows the on-screen console, an overlay with the console output of the Core App.
When the setting changes, the device restarts the application shortly after the promise resolves.
The console shows only the Core App's output, not the applet's own console calls, and native layers such as
foreground video or sos.browser.open() cover it.
enableOnScreenConsole(): Promise<void>;
Return value
A promise that resolves when the setting is saved.
Possible errors
If the device does not support the on-screen console.
Example
if (!(await sos.management.debug.isOnScreenConsoleEnabled())) {
await sos.management.debug.enableOnScreenConsole();
}
isEnabled()
The isEnabled() method returns whether the native debug mode is enabled.
isEnabled(): Promise<boolean>;
Return value
A promise that resolves to true if the debug mode is enabled, otherwise false.
Example
const isDebugEnabled = await sos.management.debug.isEnabled();
console.log(`Native debug mode is ${isDebugEnabled ? 'enabled' : 'disabled'}.`);
isOnScreenConsoleEnabled()
The isOnScreenConsoleEnabled() method returns whether the on-screen console is enabled.
isOnScreenConsoleEnabled(): Promise<boolean>;
Return value
A promise that resolves to true if the on-screen console is enabled, otherwise false.
Example
const isConsoleEnabled = await sos.management.debug.isOnScreenConsoleEnabled();
console.log(`On-screen console is ${isConsoleEnabled ? 'enabled' : 'disabled'}.`);
setDebug()
The setDebug(enabled) method sets the native debug mode to the specified state.
setDebug(enabled: boolean): Promise<void>;
Params
| Name | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | true to enable the debug mode, false to disable it. |
Return value
A promise that resolves when the debug mode is set.
Possible errors
If the enabled parameter is not a boolean.
Example
const enabled = await sos.management.debug.isEnabled();
if (!enabled) {
await sos.management.debug.setDebug(true);
}