powerOffOnClose
info
Added in Scrcpy 1.18
- Type:
boolean - Default value:
false
Automatically powers off the Android device when the scrcpy connection is closed.
When enabled, the device will be powered off automatically when the scrcpy client disconnects or the connection is terminated. This can be useful for automated testing scenarios or when you want to ensure the device enters power saving mode after screen mirroring ends.
Related options
powerOn: Controls whether the server should power on the device when starting streamingstayAwake: Prevents the device from sleeping while screen casting is active
Example
import { ScrcpyOptions1_18 } from "@yume-chan/scrcpy";
const options = new ScrcpyOptions1_18({
powerOffOnClose: true, // Power off device when connection closes
});
Equivalent ADB command
scrcpy --power-off-on-close