ScreenLocked
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Read whether the screen is locked, or lock and unlock it. These call app_lock.
ScreenLocked
public bool ScreenLocked()
public bool ScreenLocked(bool locked)
Whether the screen is locked.
Locks or unlocks the screen, confirmed against the device. A state rather than a power-button press: power is a toggle, so asking twice leaves the device where it started. A device with a PIN, pattern or password cannot be unlocked from outside and throws.
Examples
Lock the screen
device.ScreenLocked(true);
Unlock it
device.ScreenLocked(false);